Support for extended underline styles, 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:
Nicholas Marriott
2018-10-08 13:21:37 +01:00
parent 46847e9b2e
commit 4b9e76aaaa
7 changed files with 159 additions and 43 deletions

16
grid.c
View File

@@ -764,7 +764,11 @@ grid_string_cells_code(const struct grid_cell *lastgc,
{ GRID_ATTR_BLINK, 5 },
{ GRID_ATTR_REVERSE, 7 },
{ GRID_ATTR_HIDDEN, 8 },
{ GRID_ATTR_STRIKETHROUGH, 9 }
{ GRID_ATTR_STRIKETHROUGH, 9 },
{ GRID_ATTR_UNDERSCORE_2, 42 },
{ GRID_ATTR_UNDERSCORE_3, 43 },
{ GRID_ATTR_UNDERSCORE_4, 44 },
{ GRID_ATTR_UNDERSCORE_5, 45 },
};
n = 0;
@@ -790,11 +794,15 @@ grid_string_cells_code(const struct grid_cell *lastgc,
else
strlcat(buf, "\033[", len);
for (i = 0; i < n; i++) {
if (i + 1 < n)
xsnprintf(tmp, sizeof tmp, "%d;", s[i]);
else
if (s[i] < 10)
xsnprintf(tmp, sizeof tmp, "%d", s[i]);
else {
xsnprintf(tmp, sizeof tmp, "%d:%d", s[i] / 10,
s[i] % 10);
}
strlcat(buf, tmp, len);
if (i + 1 < n)
strlcat(buf, ";", len);
}
strlcat(buf, "m", len);
}