diff options
author | nicm <nicm> | 2020-05-16 14:46:14 +0000 |
---|---|---|
committer | nicm <nicm> | 2020-05-16 14:46:14 +0000 |
commit | 7dbe623156e7b0e32e10e5e6445b7b7e448cc3a2 (patch) | |
tree | 0ffb9f32bc1d6548d307731d2e05c2dfb728b667 /tty-term.c | |
parent | 21a39c997b82b50b0307e836e4f11f9db6a84e55 (diff) | |
download | rtmux-7dbe623156e7b0e32e10e5e6445b7b7e448cc3a2.tar.gz rtmux-7dbe623156e7b0e32e10e5e6445b7b7e448cc3a2.tar.bz2 rtmux-7dbe623156e7b0e32e10e5e6445b7b7e448cc3a2.zip |
Instead of having a default set of terminals in terminal-overrides that
get XT added and using that as a marker for xterm(1)-like, assume that
if the terminfo(5) entry already has XT or the clear capability starts
with CSI then the terminal is VT100-like and it should be safe to send
DA requests. The DA responses trigger additional features being added.
Diffstat (limited to 'tty-term.c')
-rw-r--r-- | tty-term.c | 30 |
1 files changed, 21 insertions, 9 deletions
@@ -83,6 +83,8 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_DIM] = { TTYCODE_STRING, "dim" }, [TTYC_DL1] = { TTYCODE_STRING, "dl1" }, [TTYC_DL] = { TTYCODE_STRING, "dl" }, + [TTYC_DSFCS] = { TTYCODE_STRING, "Dsfcs" }, + [TTYC_DSBP] = { TTYCODE_STRING, "Dsbp" }, [TTYC_DSMG] = { TTYCODE_STRING, "Dsmg" }, [TTYC_E3] = { TTYCODE_STRING, "E3" }, [TTYC_ECH] = { TTYCODE_STRING, "ech" }, @@ -90,6 +92,8 @@ static const struct tty_term_code_entry tty_term_codes[] = { [TTYC_EL1] = { TTYCODE_STRING, "el1" }, [TTYC_EL] = { TTYCODE_STRING, "el" }, [TTYC_ENACS] = { TTYCODE_STRING, "enacs" }, + [TTYC_ENBP] = { TTYCODE_STRING, "Enbp" }, + [TTYC_ENFCS] = { TTYCODE_STRING, "Enfcs" }, [TTYC_ENMG] = { TTYCODE_STRING, "Enmg" }, [TTYC_FSL] = { TTYCODE_STRING, "fsl" }, [TTYC_HOME] = { TTYCODE_STRING, "home" }, @@ -545,21 +549,29 @@ 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. */ if ((tty_term_flag(term, TTYC_TC) || tty_term_has(term, TTYC_RGB)) && (!tty_term_has(term, TTYC_SETRGBF) || !tty_term_has(term, TTYC_SETRGBB))) - tty_add_features(feat, "RGB", ":,"); - - /* Add feature if terminal has XT. */ - if (tty_term_flag(term, TTYC_XT)) - tty_add_features(feat, "title", ":,"); + tty_add_features(feat, "RGB", ","); /* Apply the features and overrides again. */ tty_apply_features(term, *feat); |