Commit: patch 9.1.2107: :normal may change cmdline history

1 view
Skip to first unread message

Christian Brabandt

unread,
Jan 23, 2026, 2:31:22 PM (2 days ago) Jan 23
to vim...@googlegroups.com
patch 9.1.2107: :normal may change cmdline history

Commit: https://github.com/vim/vim/commit/85241020e808a74221a4befa367ceeda76af7ee0
Author: zeertzjq <zeer...@outlook.com>
Date: Fri Jan 23 19:21:42 2026 +0000

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 <zeer...@outlook.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 65d4c6957..ce28088d5 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -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.
diff --git a/src/testdir/test_cmdline.vim b/src/testdir/test_cmdline.vim
index ea018d593..419d48723 100644
--- a/src/testdir/test_cmdline.vim
+++ b/src/testdir/test_cmdline.vim
@@ -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'])
diff --git a/src/version.c b/src/version.c
index 5017e1d7b..6e02d540a 100644
--- a/src/version.c
+++ b/src/version.c
@@ -734,6 +734,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 2107,
/**/
2106,
/**/
Reply all
Reply to author
Forward
0 new messages