mirror of
https://github.com/vim/vim.git
synced 2026-05-28 00:21:37 +02:00
patch 9.1.2107: :normal may change cmdline history
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: #19237
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
7d22f84f0b
commit
85241020e8
+1
-1
@@ -1871,7 +1871,7 @@ getcmdline_int(
|
||||
// that occurs while typing a command should
|
||||
// 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
|
||||
// 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.
|
||||
|
||||
@@ -2675,6 +2675,7 @@ func Test_recalling_cmdline_with_mappings()
|
||||
call assert_equal("echo 'bar'", histget(':', -1))
|
||||
call assert_equal("echo 'foo'", histget(':', -2))
|
||||
|
||||
let g:cmdline = ''
|
||||
" This command comes completely from a mapping.
|
||||
nmap <F3> :echo 'baz'<F2><CR>
|
||||
call feedkeys("\<F3>", 'tx')
|
||||
@@ -2684,6 +2685,15 @@ func Test_recalling_cmdline_with_mappings()
|
||||
call assert_equal("echo 'bar'", histget(':', -1))
|
||||
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')
|
||||
new
|
||||
call setline(1, ['aaa'])
|
||||
|
||||
@@ -734,6 +734,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
2107,
|
||||
/**/
|
||||
2106,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user