patch 9.1.2107: :normal may change cmdline history

Commit: 
https://github.com/vim/vim/commit/85241020e808a74221a4befa367ceeda76af7ee0
Author: zeertzjq <[email protected]>
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 <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

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,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1vjMr7-00AHIe-GF%40256bit.org.

Raspunde prin e-mail lui