mirror of
https://github.com/vim/vim.git
synced 2025-10-24 08:54:47 -04:00
patch 9.1.1679: unclear what key causes CmdlineLeave autocommand
Problem: unclear what key causes CmdlineLeave autocommand Solution: Set |v:char| to the key (Girish Palya). related: #17806 closes: #18063 Signed-off-by: Girish Palya <girishji@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
53466887f7
commit
ba9551d131
@@ -4918,4 +4918,23 @@ func Test_long_line_noselect()
|
||||
call StopVimInTerminal(buf)
|
||||
endfunc
|
||||
|
||||
func Test_CmdlineLeave_vchar_keys()
|
||||
func OnLeave()
|
||||
let g:leave_key = v:char
|
||||
endfunction
|
||||
|
||||
new
|
||||
for event in ["CmdlineLeavePre", "CmdlineLeave"]
|
||||
exec "autocmd" event "* :call OnLeave()"
|
||||
for key in ["\<C-C>", "\<Esc>", "\<CR>"]
|
||||
call feedkeys($":echo{key}", 'tx')
|
||||
call assert_equal(key, g:leave_key)
|
||||
endfor
|
||||
exec "autocmd!" event
|
||||
endfor
|
||||
bwipe!
|
||||
delfunc OnLeave
|
||||
unlet g:leave_key
|
||||
endfunc
|
||||
|
||||
" vim: shiftwidth=2 sts=2 expandtab
|
||||
|
||||
Reference in New Issue
Block a user