Allow features to be disabled using @ suffix in terminal-features, from

Michael Grant.
This commit is contained in:
nicm
2026-08-17 14:47:41 +00:00
committed by tmux update bot
parent 1729bb8e8a
commit a18d4e0067
7 changed files with 89 additions and 57 deletions

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty-term.c,v 1.107 2026/08/05 08:54:56 nicm Exp $ */
/* $OpenBSD: tty-term.c,v 1.108 2026/08/17 14:47:41 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -541,8 +541,9 @@ tty_term_validate(struct tty_term *term)
struct tty_term *
tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
int *feat, char **cause)
char **cause)
{
struct client *c = tty->client;
struct tty_term *term;
const struct tty_term_code_entry *ent;
struct tty_code *code;
@@ -614,19 +615,19 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
offset = 0;
first = tty_term_override_next(s, &offset);
if (first != NULL && fnmatch(first, term->name, 0) == 0)
tty_add_features(feat, s + offset, ":");
tty_parse_client_features(c, s + offset, ":");
a = options_array_next(a);
}
/* Check for COLORTERM. */
envent = environ_find(tty->client->environ, "COLORTERM");
envent = environ_find(c->environ, "COLORTERM");
if (envent != NULL) {
log_debug("%s COLORTERM=%s", tty->client->name, envent->value);
log_debug("%s COLORTERM=%s", c->name, envent->value);
if (strcasecmp(envent->value, "truecolor") == 0 ||
strcasecmp(envent->value, "24bit") == 0)
tty_add_features(feat, "RGB", ",");
tty_parse_client_features(c, "RGB", ",");
else if (strstr(envent->value, "256") != NULL)
tty_add_features(feat, "256", ",");
tty_parse_client_features(c, "256", ",");
}
/* Apply overrides so any capabilities used for features are changed. */
@@ -657,17 +658,17 @@ tty_term_create(struct tty *tty, char *name, char **caps, u_int ncaps,
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", ",");
tty_parse_client_features(c, "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", ",");
tty_parse_client_features(c, "RGB", ",");
/* Apply the features and overrides again. */
if (tty_apply_features(term, *feat))
if (tty_apply_features(term))
tty_term_apply_overrides(term);
/* Log the capabilities. */