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.
diff --git a/src/edit.c b/src/edit.c
index 01e5cc2..43f7d9a 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -571,6 +571,8 @@
#ifdef USE_ON_FLY_SCROLL
dont_scroll = FALSE; // allow scrolling here
#endif
+ // May request the keyboard protocol state now.
+ may_send_t_RK();
/*
* Get a character for Insert mode. Ignore K_IGNORE and K_NOP.
@@ -1479,7 +1481,8 @@
aco_save_T aco;
varnumber_T tick = CHANGEDTICK(curbuf);
- // save and restore curwin and curbuf, in case the autocmd changes them
+ // Save and restore curwin and curbuf, in case the autocmd changes
+ // them.
aucmd_prepbuf(&aco, curbuf);
apply_autocmds(EVENT_TEXTCHANGEDI, NULL, NULL, FALSE, curbuf);
aucmd_restbuf(&aco);
@@ -1499,7 +1502,8 @@
aco_save_T aco;
varnumber_T tick = CHANGEDTICK(curbuf);
- // save and restore curwin and curbuf, in case the autocmd changes them
+ // Save and restore curwin and curbuf, in case the autocmd changes
+ // them.
aucmd_prepbuf(&aco, curbuf);
apply_autocmds(EVENT_TEXTCHANGEDP, NULL, NULL, FALSE, curbuf);
aucmd_restbuf(&aco);
@@ -3706,7 +3710,7 @@
out_str(T_BE);
// Re-enable modifyOtherKeys.
- out_str(T_CTI);
+ out_str_t_TI();
}
#ifdef FEAT_CONCEAL
// Check if the cursor line needs redrawing after changing State. If
@@ -4384,6 +4388,7 @@
do
c = vgetc();
while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
+
if (c == NUL || got_int || (ex_normal_busy > 0 && c == Ctrl_C))
// When CTRL-C was encountered the typeahead will be flushed and we
// won't get the end sequence. Except when using ":normal".