summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-05-13 20:10:24 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-05-13 20:10:24 +0000
commit4034dd78eabf2bbdbe52a8ee7772f050bcabe969 (patch)
treeb11a6d229d7c6d17fb7242502ec1336a893bfcc0
parentf62f83a5e588eb5ec1577005dd6319024c72dca4 (diff)
Add support for overline (SGR 53), from Ricardo Banffy.
-rw-r--r--usr.bin/tmux/attributes.c10
-rw-r--r--usr.bin/tmux/grid.c3
-rw-r--r--usr.bin/tmux/input.c8
-rw-r--r--usr.bin/tmux/tmux.15
-rw-r--r--usr.bin/tmux/tmux.h4
-rw-r--r--usr.bin/tmux/tty-term.c3
-rw-r--r--usr.bin/tmux/tty.c4
7 files changed, 27 insertions, 10 deletions
diff --git a/usr.bin/tmux/attributes.c b/usr.bin/tmux/attributes.c
index ec47e8d2672..39a24e17751 100644
--- a/usr.bin/tmux/attributes.c
+++ b/usr.bin/tmux/attributes.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: attributes.c,v 1.8 2018/10/18 07:57:57 nicm Exp $ */
+/* $OpenBSD: attributes.c,v 1.9 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
@@ -31,7 +31,7 @@ attributes_tostring(int attr)
if (attr == 0)
return ("none");
- len = xsnprintf(buf, sizeof buf, "%s%s%s%s%s%s%s%s%s%s%s%s",
+ len = xsnprintf(buf, sizeof buf, "%s%s%s%s%s%s%s%s%s%s%s%s%s",
(attr & GRID_ATTR_BRIGHT) ? "bright," : "",
(attr & GRID_ATTR_DIM) ? "dim," : "",
(attr & GRID_ATTR_UNDERSCORE) ? "underscore," : "",
@@ -43,7 +43,8 @@ attributes_tostring(int attr)
(attr & GRID_ATTR_UNDERSCORE_2) ? "double-underscore," : "",
(attr & GRID_ATTR_UNDERSCORE_3) ? "curly-underscore," : "",
(attr & GRID_ATTR_UNDERSCORE_4) ? "dotted-underscore," : "",
- (attr & GRID_ATTR_UNDERSCORE_5) ? "dashed-underscore," : "");
+ (attr & GRID_ATTR_UNDERSCORE_5) ? "dashed-underscore," : "",
+ (attr & GRID_ATTR_OVERLINE) ? "overline," : "");
if (len > 0)
buf[len - 1] = '\0';
@@ -73,7 +74,8 @@ attributes_fromstring(const char *str)
{ "double-underscore", GRID_ATTR_UNDERSCORE_2 },
{ "curly-underscore", GRID_ATTR_UNDERSCORE_3 },
{ "dotted-underscore", GRID_ATTR_UNDERSCORE_4 },
- { "dashed-underscore", GRID_ATTR_UNDERSCORE_5 }
+ { "dashed-underscore", GRID_ATTR_UNDERSCORE_5 },
+ { "overline", GRID_ATTR_OVERLINE }
};
if (*str == '\0' || strcspn(str, delimiters) == 0)
diff --git a/usr.bin/tmux/grid.c b/usr.bin/tmux/grid.c
index 47c5ded3f96..451df187b77 100644
--- a/usr.bin/tmux/grid.c
+++ b/usr.bin/tmux/grid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: grid.c,v 1.93 2019/04/02 08:45:32 nicm Exp $ */
+/* $OpenBSD: grid.c,v 1.94 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -790,6 +790,7 @@ grid_string_cells_code(const struct grid_cell *lastgc,
{ GRID_ATTR_UNDERSCORE_3, 43 },
{ GRID_ATTR_UNDERSCORE_4, 44 },
{ GRID_ATTR_UNDERSCORE_5, 45 },
+ { GRID_ATTR_OVERLINE, 53 },
};
n = 0;
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index b831734b01e..0b98386f04c 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.152 2019/05/07 10:25:15 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.153 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2070,6 +2070,12 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
case 49:
gc->bg = 8;
break;
+ case 53:
+ gc->attr |= GRID_ATTR_OVERLINE;
+ break;
+ case 55:
+ gc->attr &= ~GRID_ATTR_OVERLINE;
+ break;
case 90:
case 91:
case 92:
diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1
index c9a49d3d2f0..a9089f045a0 100644
--- a/usr.bin/tmux/tmux.1
+++ b/usr.bin/tmux/tmux.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: tmux.1,v 1.648 2019/05/13 08:56:07 nicm Exp $
+.\" $OpenBSD: tmux.1,v 1.649 2019/05/13 20:10:23 nicm Exp $
.\"
.\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
.\"
@@ -4091,6 +4091,7 @@ Set no attributes (turn off any active attributes).
.Ic reverse ,
.Ic hidden ,
.Ic italics ,
+.Ic overline ,
.Ic strikethrough ,
.Ic double-underscore ,
.Ic curly-underscore ,
@@ -4820,6 +4821,8 @@ to change the cursor colour from inside
.Bd -literal -offset indent
$ printf '\e033]12;red\e033\e\e'
.Ed
+.It Em \&Smol
+Enable the overline attribute.
.It Em \&Smulx
Set a styled underline.
The single parameter is one of: 0 for no underline, 1 for normal
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 85edb564746..55aef4e1020 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.897 2019/05/12 08:58:09 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.898 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -431,6 +431,7 @@ enum tty_code_code {
TTYC_SITM,
TTYC_SMACS,
TTYC_SMCUP,
+ TTYC_SMOL,
TTYC_SMKX,
TTYC_SMSO,
TTYC_SMULX,
@@ -568,6 +569,7 @@ enum utf8_state {
#define GRID_ATTR_UNDERSCORE_3 0x400
#define GRID_ATTR_UNDERSCORE_4 0x800
#define GRID_ATTR_UNDERSCORE_5 0x1000
+#define GRID_ATTR_OVERLINE 0x2000
/* All underscore attributes. */
#define GRID_ATTR_ALL_UNDERSCORE \
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c
index e3db804c190..ec44c6ec68e 100644
--- a/usr.bin/tmux/tty-term.c
+++ b/usr.bin/tmux/tty-term.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-term.c,v 1.63 2019/04/25 19:36:59 nicm Exp $ */
+/* $OpenBSD: tty-term.c,v 1.64 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -252,6 +252,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SMACS] = { TTYCODE_STRING, "smacs" },
[TTYC_SMCUP] = { TTYCODE_STRING, "smcup" },
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" },
+ [TTYC_SMOL] = { TTYCODE_STRING, "Smol" },
[TTYC_SMSO] = { TTYCODE_STRING, "smso" },
[TTYC_SMULX] = { TTYCODE_STRING, "Smulx" },
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index 027b9462204..6c6aecfb58a 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.323 2019/04/25 19:03:43 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.324 2019/05/13 20:10:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -2199,6 +2199,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
tty_putcode(tty, TTYC_INVIS);
if (changed & GRID_ATTR_STRIKETHROUGH)
tty_putcode(tty, TTYC_SMXX);
+ if (changed & GRID_ATTR_OVERLINE)
+ tty_putcode(tty, TTYC_SMOL);
if ((changed & GRID_ATTR_CHARSET) && tty_acs_needed(tty))
tty_putcode(tty, TTYC_SMACS);
}