fix: prevent K_EVENT from stopping Select mode CTRL-O #15688

When using Goneovim, Select mode `CTRL-O` returns back to Select mode
immediately (even with `--clean`). Neovim TUI (with some plugins) also randomly
returns to Select mode even if no keys are pressed when using `CTRL-O` in Select
mode.
This commit is contained in:
zeertzjq
2021-09-17 21:17:51 +08:00
committed by GitHub
parent c4b7744704
commit 5f144efefa
3 changed files with 26 additions and 4 deletions

View File

@@ -8404,13 +8404,13 @@ static void nv_event(cmdarg_T *cap)
// not safe to perform garbage collection because there could be unreferenced
// lists or dicts being used.
may_garbage_collect = false;
bool may_restart = (restart_edit != 0);
bool may_restart = (restart_edit != 0 || restart_VIsual_select != 0);
state_handle_k_event();
finish_op = false;
if (may_restart) {
// Tricky: if restart_edit was set before the handler we are in ctrl-o mode,
// but if not, the event should be allowed to trigger :startinsert.
cap->retval |= CA_COMMAND_BUSY; // don't call edit() now
cap->retval |= CA_COMMAND_BUSY; // don't call edit() or restart Select now
}
}