patch 9.0.2178: reg_executing() wrong for :normal with range

Commit: 
https://github.com/vim/vim/commit/615202bd0ebc1d8e3532f24b9b7232c2fd86b181
Author: zeertzjq <[email protected]>
Date:   Tue Dec 19 20:35:40 2023 +0100

    patch 9.0.2178: reg_executing() wrong for :normal with range
    
    Problem:  reg_executing() returns wrong result in :normal with range
              when 'showcmd' is set (after 8.2.4705).
    Solution: Reset "pending_end_reg_executing" when executing a register.
    
    closes: #13707
    
    Signed-off-by: zeertzjq <[email protected]>
    Signed-off-by: Christian Brabandt <[email protected]>

diff --git a/src/globals.h b/src/globals.h
index c03fe97db..b74ef3541 100644
--- a/src/globals.h
+++ b/src/globals.h
@@ -1377,7 +1377,7 @@ EXTERN int ex_no_reprint INIT(= FALSE); // no need to 
print after z or p
 EXTERN int reg_recording INIT(= 0);    // register for recording  or zero
 EXTERN int reg_executing INIT(= 0);    // register being executed or zero
 // Flag set when peeking a character and found the end of executed register
-EXTERN int pending_end_reg_executing INIT(= 0);
+EXTERN int pending_end_reg_executing INIT(= FALSE);
 
 // Set when a modifyOtherKeys sequence was seen, then simplified mappings will
 // no longer be used.  To be combined with modify_otherkeys_state.
diff --git a/src/register.c b/src/register.c
index 9a23be859..1d0e46bd0 100644
--- a/src/register.c
+++ b/src/register.c
@@ -703,6 +703,7 @@ do_execreg(
                return FAIL;
        }
        reg_executing = regname == 0 ? '"' : regname; // disable "q" command
+       pending_end_reg_executing = FALSE;
     }
     return retval;
 }
diff --git a/src/testdir/test_registers.vim b/src/testdir/test_registers.vim
index e8bee99d7..f85e72735 100644
--- a/src/testdir/test_registers.vim
+++ b/src/testdir/test_registers.vim
@@ -840,6 +840,23 @@ func Test_end_reg_executing()
   bwipe!
 endfunc
 
+func Test_reg_executing_in_range_normal()
+  new
+  set showcmd
+  call setline(1, range(10))
+  let g:log = []
+  nnoremap s <Cmd>let g:log += [reg_executing()]<CR>
+  let @r = 's'
+
+  %normal @r
+  call assert_equal(repeat(['r'], 10), g:log)
+
+  nunmap s
+  unlet g:log
+  set showcmd&
+  bwipe!
+endfunc
+
 " An operator-pending mode mapping shouldn't be applied to keys typed in
 " Insert mode immediately after a character search when replaying.
 func Test_replay_charsearch_omap()
diff --git a/src/version.c b/src/version.c
index b8dfc98a2..498c346a9 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2178,
 /**/
     2177,
 /**/

-- 
-- 
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 on the web visit 
https://groups.google.com/d/msgid/vim_dev/E1rFg1X-003bW4-AJ%40256bit.org.

Raspunde prin e-mail lui