summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/input.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2018-10-18 07:57:57 +0000
committernicm <nicm@openbsd.org>2018-10-18 07:57:57 +0000
commit42caa3399e0524340f9e4fb3e0677d185af4dd31 (patch)
tree7b996e92c90b1a2756bdd984193fe1d1e5af9d73 /usr.bin/tmux/input.c
parentFix not accounting for NUL for allocation size and move to reallocarray (diff)
downloadwireguard-openbsd-42caa3399e0524340f9e4fb3e0677d185af4dd31.tar.xz
wireguard-openbsd-42caa3399e0524340f9e4fb3e0677d185af4dd31.zip
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.
Diffstat (limited to 'usr.bin/tmux/input.c')
-rw-r--r--usr.bin/tmux/input.c48
1 files changed, 41 insertions, 7 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index b657d6d5cc2..3083e127800 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.136 2018/08/16 14:04:03 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.137 2018/10/18 07:57:57 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1835,10 +1835,11 @@ input_csi_dispatch_sgr_rgb(struct input_ctx *ictx, int fgbg, u_int *i)
static void
input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)
{
- char *s = ictx->param_list[i].str, *copy, *ptr, *out;
- int p[8];
- u_int n;
- const char *errstr;
+ struct grid_cell *gc = &ictx->cell.cell;
+ char *s = ictx->param_list[i].str, *copy, *ptr, *out;
+ int p[8];
+ u_int n;
+ const char *errstr;
for (n = 0; n < nitems(p); n++)
p[n] = -1;
@@ -1857,7 +1858,39 @@ input_csi_dispatch_sgr_colon(struct input_ctx *ictx, u_int i)
}
free(copy);
- if (n == 0 || (p[0] != 38 && p[0] != 48))
+ if (n == 0)
+ return;
+ if (p[0] == 4) {
+ if (n != 2)
+ return;
+ switch (p[1]) {
+ case 0:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ break;
+ case 1:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ gc->attr |= GRID_ATTR_UNDERSCORE;
+ break;
+ case 2:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ gc->attr |= GRID_ATTR_UNDERSCORE_2;
+ break;
+ case 3:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ gc->attr |= GRID_ATTR_UNDERSCORE_3;
+ break;
+ case 4:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ gc->attr |= GRID_ATTR_UNDERSCORE_4;
+ break;
+ case 5:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
+ gc->attr |= GRID_ATTR_UNDERSCORE_5;
+ break;
+ }
+ return;
+ }
+ if (p[0] != 38 && p[0] != 48)
return;
if (p[1] == -1)
i = 2;
@@ -1927,6 +1960,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
gc->attr |= GRID_ATTR_ITALICS;
break;
case 4:
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
gc->attr |= GRID_ATTR_UNDERSCORE;
break;
case 5:
@@ -1948,7 +1982,7 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
gc->attr &= ~GRID_ATTR_ITALICS;
break;
case 24:
- gc->attr &= ~GRID_ATTR_UNDERSCORE;
+ gc->attr &= ~GRID_ATTR_ALL_UNDERSCORE;
break;
case 25:
gc->attr &= ~GRID_ATTR_BLINK;