aboutsummaryrefslogtreecommitdiff
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2020-05-16 16:44:54 +0000
committernicm <nicm>2020-05-16 16:44:54 +0000
commit0ab82d95314e7a26a48452c77ad710f3aff97dd7 (patch)
tree8a7439d2a3007bb7de92f6c8c801bb5303754fae /tty.c
parent292b335ca5b594729cf9ff79f0f4273c725537a4 (diff)
downloadrtmux-0ab82d95314e7a26a48452c77ad710f3aff97dd7.tar.gz
rtmux-0ab82d95314e7a26a48452c77ad710f3aff97dd7.tar.bz2
rtmux-0ab82d95314e7a26a48452c77ad710f3aff97dd7.zip
Add a terminal feature for enable/disable extended keys (supported by
xterm and mintty) and add an option to make tmux send it. Only forward extended keys if the application has requested them, even though we use the CSI u sequence and xterm uses CSI 27 ~ - this is what mintty does as well.
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/tty.c b/tty.c
index 99996dfa..770c8b78 100644
--- a/tty.c
+++ b/tty.c
@@ -286,6 +286,8 @@ tty_start_timer_callback(__unused int fd, __unused short events, void *data)
struct client *c = tty->client;
log_debug("%s: start timer fired", c->name);
+ if ((tty->flags & (TTY_HAVEDA|TTY_HAVEXDA)) == 0)
+ tty_update_features(tty);
tty->flags |= (TTY_HAVEDA|TTY_HAVEXDA);
}
@@ -329,13 +331,6 @@ tty_start_tty(struct tty *tty)
tty_puts(tty, "\033[?1006l\033[?1005l");
}
- if (options_get_number(global_options, "focus-events")) {
- tty->flags |= TTY_FOCUS;
- tty_raw(tty, tty_term_string(tty->term, TTYC_ENFCS));
- }
- if (tty->term->flags & TERM_VT100LIKE)
- tty_puts(tty, "\033[?7727h");
-
evtimer_set(&tty->start_timer, tty_start_timer_callback, tty);
evtimer_add(&tty->start_timer, &tv);
@@ -415,12 +410,10 @@ tty_stop_tty(struct tty *tty)
tty_raw(tty, "\033[?1006l\033[?1005l");
}
- if (tty->flags & TTY_FOCUS) {
- tty->flags &= ~TTY_FOCUS;
- tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS));
- }
if (tty->term->flags & TERM_VT100LIKE)
tty_raw(tty, "\033[?7727l");
+ tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS));
+ tty_raw(tty, tty_term_string(tty->term, TTYC_DSEKS));
if (tty_use_margin(tty))
tty_raw(tty, tty_term_string(tty->term, TTYC_DSMG));
@@ -471,6 +464,12 @@ tty_update_features(struct tty *tty)
if (tty_use_margin(tty))
tty_putcode(tty, TTYC_ENMG);
+ if (options_get_number(global_options, "extended-keys"))
+ tty_puts(tty, tty_term_string(tty->term, TTYC_ENEKS));
+ if (options_get_number(global_options, "focus-events"))
+ tty_raw(tty, tty_term_string(tty->term, TTYC_ENFCS));
+ if (tty->term->flags & TERM_VT100LIKE)
+ tty_puts(tty, "\033[?7727h");
}
void