diff src/testdir/test_autocmd.vim @ 13142:59a16624400a v8.0.1445

patch 8.0.1445: cannot act on edits in the command line commit https://github.com/vim/vim/commit/153b704e20f9c269450a7d3ea8cafcf942579ab7 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Jan 31 15:48:32 2018 +0100 patch 8.0.1445: cannot act on edits in the command line Problem: Cannot act on edits in the command line. Solution: Add the CmdlineChanged autocommand event. (xtal8, closes https://github.com/vim/vim/issues/2603, closes #2524)
author Christian Brabandt <cb@256bit.org>
date Wed, 31 Jan 2018 16:00:07 +0100
parents a0c6910e7fa4
children 6559e98f3e74
line wrap: on
line diff
--- 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