Some terminals have extended DECSCUSR to allow it to reset to the

default style and put that as the Se capability in their terminfo entry.
Change so that if Ss and Se exist, tmux does not overwrite them with its
own. GitHub issue 5476.
This commit is contained in:
nicm
2026-09-22 14:10:26 +00:00
committed by tmux update bot
parent 83f62d0acc
commit e7618f41c2
3 changed files with 14 additions and 9 deletions

5
tmux.h
View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tmux.h,v 1.1446 2026/09/22 06:58:06 nicm Exp $ */
/* $OpenBSD: tmux.h,v 1.1447 2026/09/22 14:10:26 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1708,6 +1708,7 @@ struct tty_term {
#define TERM_VT100LIKE 0x20
#define TERM_SIXEL 0x40
#define TERM_INVALIDMS 0x80
#define TERM_NOREPLACE 0x100
int flags;
LIST_ENTRY(tty_term) entry;
@@ -2942,7 +2943,7 @@ void tty_default_colours(struct grid_cell *, struct window_pane *, u_int *);
/* tty-term.c */
extern struct tty_terms tty_terms;
u_int tty_term_ncodes(void);
void tty_term_apply(struct tty_term *, const char *, int);
void tty_term_apply(struct tty_term *, const char *, int, int);
void tty_term_apply_overrides(struct tty_term *);
struct tty_term *tty_term_create(struct tty *, char *, char **, u_int, char **);
void tty_term_free(struct tty_term *);

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty-features.c,v 1.44 2026/09/22 06:58:06 nicm Exp $ */
/* $OpenBSD: tty-features.c,v 1.45 2026/09/22 14:10:26 nicm Exp $ */
/*
* Copyright (c) 2020 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -200,7 +200,7 @@ static const char *const tty_feature_cstyle_capabilities[] = {
static const struct tty_feature tty_feature_cstyle = {
"cstyle",
tty_feature_cstyle_capabilities,
0
TERM_NOREPLACE
};
/* Terminal supports cursor colours. */
@@ -544,11 +544,11 @@ tty_apply_features(struct tty_term *term)
capability = tf->capabilities;
while (*capability != NULL) {
log_debug("adding capability: %s", *capability);
tty_term_apply(term, *capability, 1);
tty_term_apply(term, *capability, 1, tf->flags);
capability++;
}
}
term->flags |= tf->flags;
term->flags |= (tf->flags & ~TERM_NOREPLACE);
if (tf == &tty_feature_utf8)
c->flags |= CLIENT_UTF8;
}

View File

@@ -1,4 +1,4 @@
/* $OpenBSD: tty-term.c,v 1.110 2026/09/22 06:58:06 nicm Exp $ */
/* $OpenBSD: tty-term.c,v 1.111 2026/09/22 14:10:26 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -361,7 +361,8 @@ tty_term_override_next(const char *s, size_t *offset)
}
void
tty_term_apply(struct tty_term *term, const char *capabilities, int quiet)
tty_term_apply(struct tty_term *term, const char *capabilities, int quiet,
int flags)
{
const struct tty_term_code_entry *ent;
struct tty_code *code;
@@ -404,6 +405,9 @@ tty_term_apply(struct tty_term *term, const char *capabilities, int quiet)
if (strcmp(s, ent->name) != 0)
continue;
code = &term->codes[i];
if ((flags & TERM_NOREPLACE) &&
code->type != TTYCODE_NONE)
continue;
if (remove) {
code->type = TTYCODE_NONE;
@@ -456,7 +460,7 @@ tty_term_apply_overrides(struct tty_term *term)
offset = 0;
first = tty_term_override_next(s, &offset);
if (first != NULL && fnmatch(first, term->name, 0) == 0)
tty_term_apply(term, s + offset, 0);
tty_term_apply(term, s + offset, 0, 0);
a = options_array_next(a);
}