Wait until the initial command sequence is done before sending a device

attributes request and other bits that prompt a reply from the terminal.
This means that stray relies are not left on the terminal if the command
has attached and then immediately detached and tmux will not be around
to receive them. Prompted by a problem report from espie@.
This commit is contained in:
nicm
2020-04-09 12:16:16 +00:00
parent ff135b34a4
commit 0e8710f507
3 changed files with 19 additions and 6 deletions

22
tty.c
View File

@ -340,12 +340,7 @@ tty_start_tty(struct tty *tty)
tty->flags |= TTY_FOCUS;
tty_puts(tty, "\033[?1004h");
}
if (~tty->flags & TTY_HAVEDA)
tty_puts(tty, "\033[c");
if (~tty->flags & TTY_HAVEDSR)
tty_puts(tty, "\033[1337n");
} else
tty->flags |= (TTY_HAVEDA|TTY_HAVEDSR);
}
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
evtimer_add(&tty->start_timer, &tv);
@ -361,6 +356,21 @@ tty_start_tty(struct tty *tty)
tty->mouse_drag_release = NULL;
}
void
tty_send_requests(struct tty *tty)
{
if (~tty->flags & TTY_STARTED)
return;
if (tty_term_flag(tty->term, TTYC_XT)) {
if (~tty->flags & TTY_HAVEDA)
tty_puts(tty, "\033[c");
if (~tty->flags & TTY_HAVEDSR)
tty_puts(tty, "\033[1337n");
} else
tty->flags |= (TTY_HAVEDA|TTY_HAVEDSR);
}
void
tty_stop_tty(struct tty *tty)
{