From e25cce5f71a883b71c9786f021f022429f725736 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Wed, 20 Dec 2023 05:01:05 +0800 Subject: [PATCH] vim-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: vim/vim#13707 https://github.com/vim/vim/commit/615202bd0ebc1d8e3532f24b9b7232c2fd86b181 (cherry picked from commit 2d1143f285abebccde7c01fdfcb508799116b5f4) --- src/nvim/ops.c | 1 + test/old/testdir/test_registers.vim | 17 +++++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 95caaa621b..6e5d79b530 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -1177,6 +1177,7 @@ int do_execreg(int regname, int colon, int addcr, int silent) } } reg_executing = regname == 0 ? '"' : regname; // disable the 'q' command + pending_end_reg_executing = false; } return retval; } diff --git a/test/old/testdir/test_registers.vim b/test/old/testdir/test_registers.vim index 45a940b3b1..9e1beb1dd2 100644 --- a/test/old/testdir/test_registers.vim +++ b/test/old/testdir/test_registers.vim @@ -800,6 +800,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 let g:log += [reg_executing()] + 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()