diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-12-01 12:03:47 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-12-01 12:03:47 +0000 |
commit | 733a69b29f0b0c3d2ddca463a41bdd912379bc5e (patch) | |
tree | 65bc4282dda846e701691450320de90c07cf5e44 /src/main.c | |
parent | 4f501171f7ba8fe3d24c7e5bf5fcec5b5f246df1 (diff) |
patch 9.0.0980: the keyboard state response may end up in a shell commandv9.0.0980
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.
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/src/main.c b/src/main.c index 9081657691..477f3d6194 100644 --- a/src/main.c +++ b/src/main.c @@ -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 |