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

615202bd0e
This commit is contained in:
zeertzjq 2023-12-20 05:01:05 +08:00
parent 49efdf8413
commit 2d1143f285
2 changed files with 18 additions and 0 deletions

View File

@ -1160,6 +1160,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;
}

View File

@ -801,6 +801,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()