mirror of
https://github.com/neovim/neovim.git
synced 2025-12-21 13:55:36 +00:00
vim-patch:9.1.1868: v:register is wrong in v_: command (#36238)
Problem: v:register is wrong in v_: command (after 9.1.1858). Solution: Don't reset v:register for OP_COLON (zeertzjq) related: https://github.com/vim/vim/pull/18583#issuecomment-3418030021 closes: vim/vim#185970124320c97While at it, also fix using stale set_prevcount value. That only matters when readbuf1 ends with an operator or a register, which never happens, but it's still good to avoid using a stale value. (cherry picked from commit68a54bfda6)
This commit is contained in:
committed by
github-actions[bot]
parent
ad172eb762
commit
a4319015ee
@@ -544,6 +544,7 @@ static void normal_prepare(NormalState *s)
|
||||
}
|
||||
may_trigger_modechanged();
|
||||
|
||||
s->set_prevcount = false;
|
||||
// When not finishing an operator and no register name typed, reset the count.
|
||||
if (!finish_op && !s->oa.regname) {
|
||||
s->ca.opcount = 0;
|
||||
@@ -962,6 +963,8 @@ static bool normal_get_command_count(NormalState *s)
|
||||
|
||||
static void normal_finish_command(NormalState *s)
|
||||
{
|
||||
bool did_visual_op = false;
|
||||
|
||||
if (s->command_finished) {
|
||||
goto normal_end;
|
||||
}
|
||||
@@ -981,11 +984,13 @@ static void normal_finish_command(NormalState *s)
|
||||
s->old_mapped_len = typebuf_maplen();
|
||||
}
|
||||
|
||||
const bool prev_VIsual_active = VIsual_active;
|
||||
|
||||
// If an operation is pending, handle it. But not for K_IGNORE or
|
||||
// K_MOUSEMOVE.
|
||||
if (s->ca.cmdchar != K_IGNORE && s->ca.cmdchar != K_MOUSEMOVE) {
|
||||
did_visual_op = VIsual_active && s->oa.op_type != OP_NOP
|
||||
// For OP_COLON, do_pending_operator() stuffs ':' into
|
||||
// the read buffer, which isn't executed immediately.
|
||||
&& s->oa.op_type != OP_COLON;
|
||||
do_pending_operator(&s->ca, s->old_col, false);
|
||||
}
|
||||
|
||||
@@ -1000,7 +1005,7 @@ normal_end:
|
||||
|
||||
msg_nowait = false;
|
||||
|
||||
if (finish_op || prev_VIsual_active) {
|
||||
if (finish_op || did_visual_op) {
|
||||
set_reg_var(get_default_register_name());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user