summaryrefslogtreecommitdiffstats
path: root/tty-term.c
diff options
context:
space:
mode:
authornicm <nicm>2020-04-20 15:37:32 +0000
committernicm <nicm>2020-04-20 15:37:32 +0000
commit117ec1b2e603c2692ab564947b099ec79a20150f (patch)
treecaa93040de57eecf5e92868674ed4eaaf6cd26b9 /tty-term.c
parent2083a6ea2050fb211eab3da0df0ff5a40b4973b4 (diff)
Apply terminal-overrides after terminal detection, it always takes
precedence.
Diffstat (limited to 'tty-term.c')
-rw-r--r--tty-term.c41
1 files changed, 26 insertions, 15 deletions
diff --git a/tty-term.c b/tty-term.c
index e1b026ea..f4a18b63 100644
--- a/tty-term.c
+++ b/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