1
0
forked from aniani/vim

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
This commit is contained in:
Bram Moolenaar
2022-12-09 12:21:50 +00:00
parent ffa4e9b43a
commit bb393d8259
5 changed files with 23 additions and 4 deletions

View File

@@ -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