Mercurial > vim
diff src/testdir/test_autocmd.vim @ 31412:742b7bf2fefc v9.0.1039
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Commit: https://github.com/vim/vim/commit/bb393d8259af8aec095e96d81624a16ed9f25005
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Dec 9 12:21:50 2022 +0000
patch 9.0.1039: using a <Cmd> mapping CmdlineChanged may be triggered twice
Problem: Using a <Cmd> mapping CmdlineChanged may be triggered twice.
Solution: Count the number of times CmdlineChanged is triggered and avoid
doing it twice. (closes #116820
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 09 Dec 2022 13:30:05 +0100 |
parents | 992bfd3aee3f |
children | db72745d328c |
line wrap: on
line diff
--- a/src/testdir/test_autocmd.vim +++ b/src/testdir/test_autocmd.vim @@ -1908,6 +1908,15 @@ func Test_Cmdline() call assert_equal(':', g:entered) au! CmdlineChanged + let g:log = [] + cnoremap <F1> <Cmd>call setcmdline('ls')<CR> + autocmd CmdlineChanged : let g:log += [getcmdline()] + call feedkeys(":\<F1>", 'xt') + call assert_equal(['ls'], g:log) + unlet g:log + au! CmdlineChanged + cunmap <F1> + au! CmdlineEnter : let g:entered = expand('<afile>') au! CmdlineLeave : let g:left = expand('<afile>') let g:entered = 0