mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
fix(redo): make redo of Lua mappings in op-pending mode work (#23566)
This commit is contained in:
@@ -5777,6 +5777,11 @@ typedef struct {
|
||||
int rv_arg; ///< extra argument
|
||||
} redo_VIsual_T;
|
||||
|
||||
static bool is_ex_cmdchar(cmdarg_T *cap)
|
||||
{
|
||||
return cap->cmdchar == ':' || cap->cmdchar == K_COMMAND;
|
||||
}
|
||||
|
||||
/// Handle an operator after Visual mode or when the movement is finished.
|
||||
/// "gui_yank" is true when yanking text for the clipboard.
|
||||
void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
@@ -5831,7 +5836,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
if ((redo_yank || oap->op_type != OP_YANK)
|
||||
&& ((!VIsual_active || oap->motion_force)
|
||||
// Also redo Operator-pending Visual mode mappings.
|
||||
|| ((cap->cmdchar == ':' || cap->cmdchar == K_COMMAND)
|
||||
|| ((is_ex_cmdchar(cap) || cap->cmdchar == K_LUA)
|
||||
&& oap->op_type != OP_COLON))
|
||||
&& cap->cmdchar != 'D'
|
||||
&& oap->op_type != OP_FOLD
|
||||
@@ -5851,7 +5856,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
AppendToRedobuffLit(cap->searchbuf, -1);
|
||||
}
|
||||
AppendToRedobuff(NL_STR);
|
||||
} else if (cap->cmdchar == ':' || cap->cmdchar == K_COMMAND) {
|
||||
} else if (is_ex_cmdchar(cap)) {
|
||||
// do_cmdline() has stored the first typed line in
|
||||
// "repeat_cmdline". When several lines are typed repeating
|
||||
// won't be possible.
|
||||
@@ -5866,6 +5871,9 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
AppendToRedobuff(NL_STR);
|
||||
XFREE_CLEAR(repeat_cmdline);
|
||||
}
|
||||
} else if (cap->cmdchar == K_LUA) {
|
||||
AppendNumberToRedobuff(repeat_luaref);
|
||||
AppendToRedobuff(NL_STR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6021,7 +6029,7 @@ void do_pending_operator(cmdarg_T *cap, int old_col, bool gui_yank)
|
||||
prep_redo(oap->regname, cap->count0,
|
||||
get_op_char(oap->op_type), get_extra_op_char(oap->op_type),
|
||||
oap->motion_force, cap->cmdchar, cap->nchar);
|
||||
} else if (cap->cmdchar != ':' && cap->cmdchar != K_COMMAND) {
|
||||
} else if (!is_ex_cmdchar(cap) && cap->cmdchar != K_LUA) {
|
||||
int opchar = get_op_char(oap->op_type);
|
||||
int extra_opchar = get_extra_op_char(oap->op_type);
|
||||
int nchar = oap->op_type == OP_REPLACE ? cap->nchar : NUL;
|
||||
|
Reference in New Issue
Block a user