diff options
author | Bram Moolenaar <Bram@vim.org> | 2018-01-31 15:48:32 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2018-01-31 15:48:32 +0100 |
commit | 153b704e20f9c269450a7d3ea8cafcf942579ab7 (patch) | |
tree | ab9438b2370889b2f49320fae762525be1ad3562 /src | |
parent | ec0557f08b2660118eaedb94471e5ab0f87cf2a3 (diff) | |
download | vim-git-153b704e20f9c269450a7d3ea8cafcf942579ab7.tar.gz |
patch 8.0.1445: cannot act on edits in the command linev8.0.1445
Problem: Cannot act on edits in the command line.
Solution: Add the CmdlineChanged autocommand event. (xtal8, closes #2603,
closes #2524)
Diffstat (limited to 'src')
-rw-r--r-- | src/ex_getln.c | 5 | ||||
-rw-r--r-- | src/fileio.c | 1 | ||||
-rw-r--r-- | src/testdir/test_autocmd.vim | 12 | ||||
-rw-r--r-- | src/version.c | 2 | ||||
-rw-r--r-- | src/vim.h | 1 |
5 files changed, 21 insertions, 0 deletions
diff --git a/src/ex_getln.c b/src/ex_getln.c index 421c6b7d5..837d29998 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -1951,6 +1951,11 @@ cmdline_not_changed: #endif cmdline_changed: +#ifdef FEAT_AUTOCMD + /* Trigger CmdlineChanged autocommands. */ + trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); +#endif + #ifdef FEAT_SEARCH_EXTRA /* * 'incsearch' highlighting. diff --git a/src/fileio.c b/src/fileio.c index ba9ec9ec0..fb5af6446 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -7786,6 +7786,7 @@ static struct event_name {"BufWritePost", EVENT_BUFWRITEPOST}, {"BufWritePre", EVENT_BUFWRITEPRE}, {"BufWriteCmd", EVENT_BUFWRITECMD}, + {"CmdlineChanged", EVENT_CMDLINECHANGED}, {"CmdlineEnter", EVENT_CMDLINEENTER}, {"CmdlineLeave", EVENT_CMDLINELEAVE}, {"CmdwinEnter", EVENT_CMDWINENTER}, diff --git a/src/testdir/test_autocmd.vim b/src/testdir/test_autocmd.vim index d8fddffeb..b7d43b59a 100644 --- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -812,6 +812,18 @@ func Test_QuitPre() endfunc func Test_Cmdline() + au! CmdlineChanged : let g:text = getcmdline() + let g:text = 0 + call feedkeys(":echom 'hello'\<CR>", 'xt') + call assert_equal("echom 'hello'", g:text) + au! CmdlineChanged + + au! CmdlineChanged : let g:entered = expand('<afile>') + let g:entered = 0 + call feedkeys(":echom 'hello'\<CR>", 'xt') + call assert_equal(':', g:entered) + au! CmdlineChanged + au! CmdlineEnter : let g:entered = expand('<afile>') au! CmdlineLeave : let g:left = expand('<afile>') let g:entered = 0 diff --git a/src/version.c b/src/version.c index bab773660..dad271555 100644 --- a/src/version.c +++ b/src/version.c @@ -772,6 +772,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1445, +/**/ 1444, /**/ 1443, @@ -1269,6 +1269,7 @@ enum auto_event EVENT_BUFWRITEPOST, /* after writing a buffer */ EVENT_BUFWRITEPRE, /* before writing a buffer */ EVENT_BUFWRITECMD, /* write buffer using command */ + EVENT_CMDLINECHANGED, /* command line was modified*/ EVENT_CMDLINEENTER, /* after entering the command line */ EVENT_CMDLINELEAVE, /* before leaving the command line */ EVENT_CMDWINENTER, /* after entering the cmdline window */ |