diff options
author | nicm <nicm> | 2020-04-09 12:16:16 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-04-09 12:16:16 +0000 |
commit | 0e8710f507acda408e3daf1ad71b33997e126505 (patch) | |
tree | fb7bebae147ad68c44d335a2f3ff8612f2f33f87 | |
parent | ff135b34a41b388b9ac98e2f655cf487ace6aa43 (diff) | |
download | rtmux-0e8710f507acda408e3daf1ad71b33997e126505.tar.gz rtmux-0e8710f507acda408e3daf1ad71b33997e126505.tar.bz2 rtmux-0e8710f507acda408e3daf1ad71b33997e126505.zip |
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@.
-rw-r--r-- | server-client.c | 2 | ||||
-rw-r--r-- | tmux.h | 1 | ||||
-rw-r--r-- | tty.c | 22 |
3 files changed, 19 insertions, 6 deletions
diff --git a/server-client.c b/server-client.c index 70244620..5d39e492 100644 --- a/server-client.c +++ b/server-client.c @@ -1898,6 +1898,8 @@ server_client_command_done(struct cmdq_item *item, __unused void *data) if (~c->flags & CLIENT_ATTACHED) c->flags |= CLIENT_EXIT; + else if (~c->flags & CLIENT_DETACHING) + tty_send_requests(&c->tty); return (CMD_RETURN_NORMAL); } @@ -1995,6 +1995,7 @@ int tty_init(struct tty *, struct client *, int, char *); void tty_resize(struct tty *); void tty_set_size(struct tty *, u_int, u_int, u_int, u_int); void tty_start_tty(struct tty *); +void tty_send_requests(struct tty *); void tty_stop_tty(struct tty *); void tty_set_title(struct tty *, const char *); void tty_update_mode(struct tty *, int, struct screen *); @@ -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); @@ -362,6 +357,21 @@ tty_start_tty(struct tty *tty) } 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) { struct winsize ws; |