mirror of
https://github.com/tmux/tmux.git
synced 2024-12-12 17:38:48 +00:00
Apply terminal-overrides after terminal detection, it always takes
precedence.
This commit is contained in:
parent
2083a6ea20
commit
117ec1b2e6
3
tmux.h
3
tmux.h
@ -1997,6 +1997,7 @@ void tty_cmd_syncstart(struct tty *, const struct tty_ctx *);
|
||||
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_overrides(struct tty_term *);
|
||||
struct tty_term *tty_term_create(struct tty *, char *, int *, int, char **);
|
||||
void tty_term_free(struct tty_term *);
|
||||
int tty_term_has(struct tty_term *, enum tty_code_code);
|
||||
@ -2017,7 +2018,7 @@ const char *tty_term_describe(struct tty_term *, enum tty_code_code);
|
||||
/* tty-features.c */
|
||||
void tty_add_features(int *, const char *, const char *);
|
||||
const char *tty_get_features(int);
|
||||
void tty_apply_features(struct tty_term *, int);
|
||||
int tty_apply_features(struct tty_term *, int);
|
||||
|
||||
/* tty-acs.c */
|
||||
int tty_acs_needed(struct tty *);
|
||||
|
@ -232,7 +232,7 @@ tty_get_features(int feat)
|
||||
return (s);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
tty_apply_features(struct tty_term *term, int feat)
|
||||
{
|
||||
const struct tty_feature *tf;
|
||||
@ -240,7 +240,7 @@ tty_apply_features(struct tty_term *term, int feat)
|
||||
u_int i;
|
||||
|
||||
if (feat == 0)
|
||||
return;
|
||||
return (0);
|
||||
log_debug("applying terminal features: %s", tty_get_features(feat));
|
||||
|
||||
for (i = 0; i < nitems(tty_features); i++) {
|
||||
@ -259,5 +259,8 @@ tty_apply_features(struct tty_term *term, int feat)
|
||||
}
|
||||
term->flags |= tf->flags;
|
||||
}
|
||||
if ((term->features | feat) == term->features)
|
||||
return (0);
|
||||
term->features |= feat;
|
||||
return (1);
|
||||
}
|
||||
|
41
tty-term.c
41
tty-term.c
@ -410,6 +410,30 @@ tty_term_apply(struct tty_term *term, const char *capabilities, int quiet)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
tty_term_apply_overrides(struct tty_term *term)
|
||||
{
|
||||
struct options_entry *o;
|
||||
struct options_array_item *a;
|
||||
union options_value *ov;
|
||||
const char *s;
|
||||
size_t offset;
|
||||
char *first;
|
||||
|
||||
o = options_get_only(global_options, "terminal-overrides");
|
||||
a = options_array_first(o);
|
||||
while (a != NULL) {
|
||||
ov = options_array_item_value(a);
|
||||
s = ov->string;
|
||||
|
||||
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);
|
||||
a = options_array_next(a);
|
||||
}
|
||||
}
|
||||
|
||||
struct tty_term *
|
||||
tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause)
|
||||
{
|
||||
@ -501,20 +525,6 @@ tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause)
|
||||
a = options_array_next(a);
|
||||
}
|
||||
|
||||
/* Apply terminal overrides. */
|
||||
o = options_get_only(global_options, "terminal-overrides");
|
||||
a = options_array_first(o);
|
||||
while (a != NULL) {
|
||||
ov = options_array_item_value(a);
|
||||
s = ov->string;
|
||||
|
||||
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);
|
||||
a = options_array_next(a);
|
||||
}
|
||||
|
||||
/* Delete curses data. */
|
||||
del_curterm(cur_term);
|
||||
|
||||
@ -544,8 +554,9 @@ tty_term_create(struct tty *tty, char *name, int *feat, int fd, char **cause)
|
||||
if (tty_term_flag(term, TTYC_XT))
|
||||
tty_add_features(feat, "title", ":,");
|
||||
|
||||
/* Apply the features. */
|
||||
/* Apply the features and overrides. */
|
||||
tty_apply_features(term, *feat);
|
||||
tty_term_apply_overrides(term);
|
||||
|
||||
/*
|
||||
* Terminals without xenl (eat newline glitch) wrap at at $COLUMNS - 1
|
||||
|
3
tty.c
3
tty.c
@ -469,7 +469,8 @@ tty_update_features(struct tty *tty)
|
||||
{
|
||||
struct client *c = tty->client;
|
||||
|
||||
tty_apply_features(tty->term, c->term_features);
|
||||
if (tty_apply_features(tty->term, c->term_features))
|
||||
tty_term_apply_overrides(tty->term);
|
||||
|
||||
if (tty_use_margin(tty))
|
||||
tty_puts(tty, "\033[?69h"); /* DECLRMM */
|
||||
|
Loading…
Reference in New Issue
Block a user