diff options
-rw-r--r-- | usr.bin/tmux/options-table.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 | ||||
-rw-r--r-- | usr.bin/tmux/tty-features.c | 5 | ||||
-rw-r--r-- | usr.bin/tmux/tty-term.c | 26 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 8 |
5 files changed, 27 insertions, 19 deletions
diff --git a/usr.bin/tmux/options-table.c b/usr.bin/tmux/options-table.c index 0472875ebdf..cd2238351e6 100644 --- a/usr.bin/tmux/options-table.c +++ b/usr.bin/tmux/options-table.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options-table.c,v 1.121 2020/05/16 14:39:40 nicm Exp $ */ +/* $OpenBSD: options-table.c,v 1.122 2020/05/16 14:46:14 nicm Exp $ */ /* * Copyright (c) 2011 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -261,7 +261,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_SERVER, .flags = OPTIONS_TABLE_IS_ARRAY, - .default_str = "tmux*:XT,rxvt*:XT,screen*:XT,xterm*:XT", + .default_str = "", .separator = "," }, diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index 2f2a6477406..e5024ba8b56 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.1021 2020/05/16 14:39:40 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.1022 2020/05/16 14:46:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1200,6 +1200,7 @@ struct tty_term { #define TERM_DECSLRM 0x4 #define TERM_DECFRA 0x8 #define TERM_RGBCOLOURS 0x10 +#define TERM_VT100LIKE 0x20 int flags; LIST_ENTRY(tty_term) entry; diff --git a/usr.bin/tmux/tty-features.c b/usr.bin/tmux/tty-features.c index 9f4a9f46d40..ab4d640c03d 100644 --- a/usr.bin/tmux/tty-features.c +++ b/usr.bin/tmux/tty-features.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-features.c,v 1.12 2020/05/16 14:39:40 nicm Exp $ */ +/* $OpenBSD: tty-features.c,v 1.13 2020/05/16 14:46:14 nicm Exp $ */ /* * Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -28,10 +28,9 @@ * - mouse (under kmous capability); * - default colours (under AX or op capabilities); * - AIX colours (under colors >= 16); - * - alternate escape (under XT). + * - alternate escape (if terminal is VT100-like). * * Also: - * - XT is used to decide whether to send DA and XDA; * - DECFRA uses a flag instead of capabilities; * - UTF-8 is a separate flag on the client; needed for unattached clients. */ diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 27ccf8f28da..2ca3c99123f 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.79 2020/05/16 14:39:40 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.80 2020/05/16 14:46:14 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -549,10 +549,22 @@ tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause) goto error; } - /* These can be emulated so one of the two is required. */ - if (!tty_term_has(term, TTYC_CUD1) && !tty_term_has(term, TTYC_CUD)) { - xasprintf(cause, "terminal does not support cud1 or cud"); - goto error; + /* + * If TERM has XT or clear starts with CSI then it is safe to assume + * the terminal is derived from the VT100. This controls whether device + * attributes requests are sent to get more information. + * + * This is a bit of a hack but there aren't that many alternatives. + * Worst case tmux will just fall back to using whatever terminfo(5) + * says without trying to correct anything that is missing. + * + * Also add few features that VT100-like terminals should either + * support or safely ignore. + */ + s = tty_term_string(term, TTYC_CLEAR); + if (tty_term_flag(term, TTYC_XT) || strncmp(s, "\033[", 2) == 0) { + term->flags |= TERM_VT100LIKE; + tty_add_features(feat, "bpaste,focus,title", ","); } /* Add RGB feature if terminal has RGB colours. */ @@ -561,10 +573,6 @@ tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause) !tty_term_has(term, TTYC_SETRGBB))) tty_add_features(feat, "RGB", ","); - /* Add some features if terminal has XT. */ - if (tty_term_flag(term, TTYC_XT)) - tty_add_features(feat, "bpaste,focus,title", ","); - /* Apply the features and overrides again. */ tty_apply_features(term, *feat); tty_term_apply_overrides(term); diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index f565c700f1e..6ae908f4fb6 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.368 2020/05/16 14:42:06 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.369 2020/05/16 14:46:14 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -334,7 +334,7 @@ tty_start_tty(struct tty *tty) tty->flags |= TTY_FOCUS; tty_raw(tty, tty_term_string(tty->term, TTYC_ENFCS)); } - if (tty_term_flag(tty->term, TTYC_XT)) + if (tty->term->flags & TERM_VT100LIKE) tty_puts(tty, "\033[?7727h"); evtimer_set(&tty->start_timer, tty_start_timer_callback, tty); @@ -357,7 +357,7 @@ tty_send_requests(struct tty *tty) if (~tty->flags & TTY_STARTED) return; - if (tty_term_flag(tty->term, TTYC_XT)) { + if (tty->term->flags & TERM_VT100LIKE) { if (~tty->flags & TTY_HAVEDA) tty_puts(tty, "\033[>c"); if (~tty->flags & TTY_HAVEXDA) @@ -420,7 +420,7 @@ tty_stop_tty(struct tty *tty) tty->flags &= ~TTY_FOCUS; tty_raw(tty, tty_term_string(tty->term, TTYC_DSFCS)); } - if (tty_term_flag(tty->term, TTYC_XT)) + if (tty->term->flags & TERM_VT100LIKE) tty_raw(tty, "\033[?7727l"); if (tty_use_margin(tty)) |