Problem: term: DECRQM codes are sent too early, the resulting DECRPM
responses can arrive after Vim has already exited, leaking
into the shell's input buffer (Christian Brabandt).
Solution: Only send DECRQM codes once termcap_active is set
(Foxe Chen).
related: #19660
fixes: #19660#issuecomment-
4085448070
closes: #19748
Signed-off-by: Foxe Chen <chen.foxe@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
may_req_bg_color();
# endif
+ // Same reason for termresponse, don't want the terminal sending out the
+ // DECRPM response after Vim has exited.
+ send_decrqm_modes();
// start in insert mode
if (p_im)
void ansi_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx);
void cterm_color2rgb(int nr, char_u *r, char_u *g, char_u *b, char_u *ansi_idx);
int term_replace_keycodes(char_u *ta_buf, int ta_len, int len_arg);
+void send_decrqm_modes(void);
void term_disable_dec(void);
void term_set_win_resize(bool state);
void term_set_sync_output(int flags);
out_str(T_FE);
#endif
- if (cur_tmode == TMODE_RAW)
- {
- // Request setting of relevant DEC modes via DECRQM
- for (int i = 0; i < (int)ARRAY_LENGTH(dec_modes); i++)
- {
- vim_snprintf((char *)IObuff, IOSIZE, "\033[?%d$p", dec_modes[i]);
- out_str(IObuff);
- }
- }
-
out_flush();
termcap_active = TRUE;
screen_start(); // don't know where cursor is now
return len;
}
+/*
+ * Query the settings for the DEC modes we support
+ */
+ void
+send_decrqm_modes(void)
+{
+ if (termcap_active && cur_tmode == TMODE_RAW)
+ {
+ // Request setting of relevant DEC modes via DECRQM
+ for (int i = 0; i < (int)ARRAY_LENGTH(dec_modes); i++)
+ {
+ vim_snprintf((char *)IObuff, IOSIZE, "\033[?%d$p", dec_modes[i]);
+ out_str(IObuff);
+ }
+ }
+}
+
/*
* Should be called when cleaning up terminal state.
*/
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 200,
/**/
199,
/**/