mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Support for extended underline styles on terminals which offer them,
enabled by adding the Smulx capability with terminal-overrides (add something like ',vte*:Smulx=\E[4\:%p1%dm'). GitHub issue 1492.
This commit is contained in:
48
tty-term.c
48
tty-term.c
@ -253,6 +253,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
||||
[TTYC_SMCUP] = { TTYCODE_STRING, "smcup" },
|
||||
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" },
|
||||
[TTYC_SMSO] = { TTYCODE_STRING, "smso" },
|
||||
[TTYC_SMULX] = { TTYCODE_STRING, "Smulx" },
|
||||
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
|
||||
[TTYC_SMXX] = { TTYCODE_STRING, "smxx" },
|
||||
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
|
||||
@ -299,25 +300,53 @@ tty_term_strip(const char *s)
|
||||
return (xstrdup(buf));
|
||||
}
|
||||
|
||||
static char *
|
||||
tty_term_override_next(const char *s, size_t *offset)
|
||||
{
|
||||
static char value[BUFSIZ];
|
||||
size_t n = 0, at = *offset;
|
||||
|
||||
if (s[at] == '\0')
|
||||
return (NULL);
|
||||
|
||||
while (s[at] != '\0') {
|
||||
if (s[at] == ':') {
|
||||
if (s[at + 1] == ':') {
|
||||
value[n++] = ':';
|
||||
at += 2;
|
||||
} else
|
||||
break;
|
||||
} else {
|
||||
value[n++] = s[at];
|
||||
at++;
|
||||
}
|
||||
if (n == (sizeof value) - 1)
|
||||
return (NULL);
|
||||
}
|
||||
if (s[at] != '\0')
|
||||
*offset = at + 1;
|
||||
else
|
||||
*offset = at;
|
||||
value[n] = '\0';
|
||||
return (value);
|
||||
}
|
||||
|
||||
static void
|
||||
tty_term_override(struct tty_term *term, const char *override)
|
||||
{
|
||||
const struct tty_term_code_entry *ent;
|
||||
struct tty_code *code;
|
||||
char *next, *s, *copy, *cp, *value;
|
||||
size_t offset = 0;
|
||||
char *cp, *value, *s;
|
||||
const char *errstr;
|
||||
u_int i;
|
||||
int n, remove;
|
||||
|
||||
copy = next = xstrdup(override);
|
||||
|
||||
s = strsep(&next, ":");
|
||||
if (s == NULL || next == NULL || fnmatch(s, term->name, 0) != 0) {
|
||||
free(copy);
|
||||
s = tty_term_override_next(override, &offset);
|
||||
if (s == NULL || fnmatch(s, term->name, 0) != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
while ((s = strsep(&next, ":")) != NULL) {
|
||||
while ((s = tty_term_override_next(override, &offset)) != NULL) {
|
||||
if (*s == '\0')
|
||||
continue;
|
||||
value = NULL;
|
||||
@ -338,6 +367,8 @@ tty_term_override(struct tty_term *term, const char *override)
|
||||
|
||||
if (remove)
|
||||
log_debug("%s override: %s@", term->name, s);
|
||||
else if (*value == '\0')
|
||||
log_debug("%s override: %s", term->name, s);
|
||||
else
|
||||
log_debug("%s override: %s=%s", term->name, s, value);
|
||||
|
||||
@ -376,7 +407,6 @@ tty_term_override(struct tty_term *term, const char *override)
|
||||
|
||||
free(value);
|
||||
}
|
||||
free(s);
|
||||
}
|
||||
|
||||
struct tty_term *
|
||||
|
Reference in New Issue
Block a user