mirror of
https://github.com/neovim/neovim.git
synced 2026-07-14 05:10:36 +00:00
vim-patch:9.1.2107: :normal may change cmdline history (#37523)
Problem: :normal may change cmdline history if the keys don't
explicitly leave Cmdline mode (after 9.1.1872).
Solution: Check ex_normal_busy (zeertzjq)
closes: vim/vim#19237
85241020e8
This commit is contained in:
@@ -1041,7 +1041,7 @@ static int command_line_check(VimState *state)
|
|||||||
// that occurs while typing a command should
|
// that occurs while typing a command should
|
||||||
// cause the command not to be executed.
|
// cause the command not to be executed.
|
||||||
|
|
||||||
if (stuff_empty() && typebuf.tb_len == 0) {
|
if (ex_normal_busy == 0 && stuff_empty() && typebuf.tb_len == 0) {
|
||||||
// There is no pending input from sources other than user input, so
|
// There is no pending input from sources other than user input, so
|
||||||
// Vim is going to wait for the user to type a key. Consider the
|
// Vim is going to wait for the user to type a key. Consider the
|
||||||
// command line typed even if next key will trigger a mapping.
|
// command line typed even if next key will trigger a mapping.
|
||||||
|
|||||||
@@ -2730,6 +2730,7 @@ func Test_recalling_cmdline_with_mappings()
|
|||||||
call assert_equal("echo 'bar'", histget(':', -1))
|
call assert_equal("echo 'bar'", histget(':', -1))
|
||||||
call assert_equal("echo 'foo'", histget(':', -2))
|
call assert_equal("echo 'foo'", histget(':', -2))
|
||||||
|
|
||||||
|
let g:cmdline = ''
|
||||||
" This command comes completely from a mapping.
|
" This command comes completely from a mapping.
|
||||||
nmap <F3> :echo 'baz'<F2><CR>
|
nmap <F3> :echo 'baz'<F2><CR>
|
||||||
call feedkeys("\<F3>", 'tx')
|
call feedkeys("\<F3>", 'tx')
|
||||||
@@ -2739,6 +2740,15 @@ func Test_recalling_cmdline_with_mappings()
|
|||||||
call assert_equal("echo 'bar'", histget(':', -1))
|
call assert_equal("echo 'bar'", histget(':', -1))
|
||||||
call assert_equal("echo 'foo'", histget(':', -2))
|
call assert_equal("echo 'foo'", histget(':', -2))
|
||||||
|
|
||||||
|
let g:cmdline = ''
|
||||||
|
" A command coming from :normal is ignored in the history even if the keys
|
||||||
|
" don't explicitly leave Cmdline mode.
|
||||||
|
exe "normal :echo 'baz'\<F2>"
|
||||||
|
call assert_equal("echo 'baz'", g:cmdline)
|
||||||
|
call assert_equal("echo 'bar'", @:)
|
||||||
|
call assert_equal("echo 'bar'", histget(':', -1))
|
||||||
|
call assert_equal("echo 'foo'", histget(':', -2))
|
||||||
|
|
||||||
if has('unix')
|
if has('unix')
|
||||||
new
|
new
|
||||||
call setline(1, ['aaa'])
|
call setline(1, ['aaa'])
|
||||||
|
|||||||
Reference in New Issue
Block a user