From: zeertzjq Date: Fri, 23 Jan 2026 19:21:42 +0000 (+0000) Subject: patch 9.1.2107: :normal may change cmdline history X-Git-Tag: v9.1.2107^0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=85241020e808a74221a4befa367ceeda76af7ee0;p=thirdparty%2Fvim.git 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 Signed-off-by: Christian Brabandt --- diff --git a/src/ex_getln.c b/src/ex_getln.c index 65d4c69577..ce28088d56 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 ea018d5932..419d487233 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 :echo 'baz' call feedkeys("\", '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'\" + 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 5017e1d7b9..6e02d540a9 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, /**/