0
0
mirror of https://github.com/vim/vim.git synced 2025-09-29 04:34:16 -04:00

patch 9.0.0980: the keyboard state response may end up in a shell command

Problem:    The keyboard state response may end up in a shell command.
Solution:   Only request the keyboard protocol state when the typeahead is
            empty, no more commands are following and not exiting.  Add the
            t_RK termcap entry for this.
This commit is contained in:
Bram Moolenaar
2022-12-01 12:03:47 +00:00
parent 4f501171f7
commit 733a69b29f
12 changed files with 110 additions and 28 deletions

View File

@@ -1133,14 +1133,14 @@ may_trigger_safestateagain(void)
// of calling feedkeys(), we check if it's now safe again (all keys
// were consumed).
was_safe = is_safe_now();
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
if (was_safe)
ch_log(NULL, "SafeState: undo reset");
#endif
# endif
}
if (was_safe)
{
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
// Only do this message when another message was given, otherwise we
// get lots of them.
if ((did_repeated_msg & REPEATED_MSG_SAFESTATE) == 0)
@@ -1151,17 +1151,26 @@ may_trigger_safestateagain(void)
"SafeState: back to waiting, triggering SafeStateAgain");
did_repeated_msg = did | REPEATED_MSG_SAFESTATE;
}
#endif
# endif
apply_autocmds(EVENT_SAFESTATEAGAIN, NULL, NULL, FALSE, curbuf);
}
#ifdef FEAT_EVAL
# ifdef FEAT_EVAL
else
ch_log(NULL,
"SafeState: back to waiting, not triggering SafeStateAgain");
#endif
# endif
}
#endif
/*
* Return TRUE if there is any typeahead, pending operator or command.
*/
int
work_pending(void)
{
return op_pending() || !is_safe_now();
}
/*
* Main loop: Execute Normal mode commands until exiting Vim.
@@ -1477,10 +1486,11 @@ main_loop(
gui_mouse_correct();
#endif
/*
* Update w_curswant if w_set_curswant has been set.
* Postponed until here to avoid computing w_virtcol too often.
*/
// May request the keyboard protocol state now.
may_send_t_RK();
// Update w_curswant if w_set_curswant has been set.
// Postponed until here to avoid computing w_virtcol too often.
update_curswant();
#ifdef FEAT_EVAL