From 733a69b29f0b0c3d2ddca463a41bdd912379bc5e Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Thu, 1 Dec 2022 12:03:47 +0000 Subject: 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. --- src/edit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/edit.c') diff --git a/src/edit.c b/src/edit.c index 01e5cc2d3e..43f7d9abb0 100644 --- a/src/edit.c +++ b/src/edit.c @@ -571,6 +571,8 @@ edit( #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 @@ ins_redraw(int ready) // not busy with something 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 @@ ins_redraw(int ready) // not busy with something 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 @@ ins_esc( 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 @@ bracketed_paste(paste_mode_T mode, int drop, garray_T *gap) 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". -- cgit v1.2.3