summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2017-03-22 08:46:12 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2017-03-22 08:46:12 +0000
commit9c0520f2c52548d0949db172662015a75926ff89 (patch)
tree1f1850fad2ed521e5b2e3d75a17e0581539f6260
parentc3dbbdaadff396bf25e2a99740dde9da8248ce02 (diff)
parent843e605b89b2da163c60739adaa48d885abfe2b3 (diff)
Merge branch 'master' of github.com:tmux/tmux
-rw-r--r--attributes.c11
-rw-r--r--grid.c5
-rw-r--r--input.c6
-rw-r--r--style.c4
-rw-r--r--tmux.13
-rw-r--r--tmux.h8
-rw-r--r--tty-term.c1
-rw-r--r--tty.c4
8 files changed, 29 insertions, 13 deletions
diff --git a/attributes.c b/attributes.c
index 046cdcc5..1e45e584 100644
--- a/attributes.c
+++ b/attributes.c
@@ -23,7 +23,7 @@
#include "tmux.h"
const char *
-attributes_tostring(u_char attr)
+attributes_tostring(int attr)
{
static char buf[128];
size_t len;
@@ -31,14 +31,15 @@ attributes_tostring(u_char attr)
if (attr == 0)
return ("none");
- len = xsnprintf(buf, sizeof buf, "%s%s%s%s%s%s%s",
+ len = xsnprintf(buf, sizeof buf, "%s%s%s%s%s%s%s%s",
(attr & GRID_ATTR_BRIGHT) ? "bright," : "",
(attr & GRID_ATTR_DIM) ? "dim," : "",
(attr & GRID_ATTR_UNDERSCORE) ? "underscore," : "",
(attr & GRID_ATTR_BLINK)? "blink," : "",
(attr & GRID_ATTR_REVERSE) ? "reverse," : "",
(attr & GRID_ATTR_HIDDEN) ? "hidden," : "",
- (attr & GRID_ATTR_ITALICS) ? "italics," : "");
+ (attr & GRID_ATTR_ITALICS) ? "italics," : "",
+ (attr & GRID_ATTR_STRIKETHROUGH) ? "strikethrough," : "");
if (len > 0)
buf[len - 1] = '\0';
@@ -49,7 +50,7 @@ int
attributes_fromstring(const char *str)
{
const char delimiters[] = " ,|";
- u_char attr;
+ int attr;
size_t end;
if (*str == '\0' || strcspn(str, delimiters) == 0)
@@ -78,6 +79,8 @@ attributes_fromstring(const char *str)
attr |= GRID_ATTR_HIDDEN;
else if (end == 7 && strncasecmp(str, "italics", end) == 0)
attr |= GRID_ATTR_ITALICS;
+ else if (end == 13 && strncasecmp(str, "strikethrough", end) == 0)
+ attr |= GRID_ATTR_STRIKETHROUGH;
else
return (-1);
str += end + strspn(str + end, delimiters);
diff --git a/grid.c b/grid.c
index 424d272a..43145eae 100644
--- a/grid.c
+++ b/grid.c
@@ -85,6 +85,8 @@ grid_need_extended_cell(const struct grid_cell_entry *gce,
{
if (gce->flags & GRID_FLAG_EXTENDED)
return (1);
+ if (gc->attr > 0xff)
+ return (1);
if (gc->data.size != 1 || gc->data.width != 1)
return (1);
if ((gc->fg & COLOUR_FLAG_RGB) ||(gc->bg & COLOUR_FLAG_RGB))
@@ -687,7 +689,8 @@ grid_string_cells_code(const struct grid_cell *lastgc,
{ GRID_ATTR_UNDERSCORE, 4 },
{ GRID_ATTR_BLINK, 5 },
{ GRID_ATTR_REVERSE, 7 },
- { GRID_ATTR_HIDDEN, 8 }
+ { GRID_ATTR_HIDDEN, 8 },
+ { GRID_ATTR_STRIKETHROUGH, 9 }
};
n = 0;
diff --git a/input.c b/input.c
index 0e71f656..0b667390 100644
--- a/input.c
+++ b/input.c
@@ -1764,6 +1764,9 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
case 8:
gc->attr |= GRID_ATTR_HIDDEN;
break;
+ case 9:
+ gc->attr |= GRID_ATTR_STRIKETHROUGH;
+ break;
case 22:
gc->attr &= ~(GRID_ATTR_BRIGHT|GRID_ATTR_DIM);
break;
@@ -1782,6 +1785,9 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
case 28:
gc->attr &= ~GRID_ATTR_HIDDEN;
break;
+ case 29:
+ gc->attr &= ~GRID_ATTR_STRIKETHROUGH;
+ break;
case 30:
case 31:
case 32:
diff --git a/style.c b/style.c
index cec1b894..6e78b3a9 100644
--- a/style.c
+++ b/style.c
@@ -31,10 +31,8 @@ style_parse(const struct grid_cell *defgc, struct grid_cell *gc,
struct grid_cell savedgc;
const char delimiters[] = " ,";
char tmp[32];
- int val;
+ int val, fg, bg, attr, flags;
size_t end;
- int fg, bg;
- u_char attr, flags;
if (*in == '\0')
return (0);
diff --git a/tmux.1 b/tmux.1
index 7a34398a..18d32e42 100644
--- a/tmux.1
+++ b/tmux.1
@@ -2668,8 +2668,9 @@ or a comma-delimited list of one or more of:
.Ic blink ,
.Ic reverse ,
.Ic hidden ,
-or
.Ic italics ,
+or
+.Ic strikethrough
to turn an attribute on, or an attribute prefixed with
.Ql no
to turn one off.
diff --git a/tmux.h b/tmux.h
index 9479cded..1cd9e9dc 100644
--- a/tmux.h
+++ b/tmux.h
@@ -399,6 +399,7 @@ enum tty_code_code {
TTYC_SMKX, /* keypad_xmit, ks */
TTYC_SMSO, /* enter_standout_mode, so */
TTYC_SMUL, /* enter_underline_mode, us */
+ TTYC_SMXX,
TTYC_SS, /* set cursor style, Ss */
TTYC_TC, /* 24-bit "true" colour, Tc */
TTYC_TSL, /* to_status_line, tsl */
@@ -510,7 +511,7 @@ enum utf8_state {
#define COLOUR_FLAG_256 0x01000000
#define COLOUR_FLAG_RGB 0x02000000
-/* Grid attributes. */
+/* Grid attributes. Anything above 0xff is stored in an extended cell. */
#define GRID_ATTR_BRIGHT 0x1
#define GRID_ATTR_DIM 0x2
#define GRID_ATTR_UNDERSCORE 0x4
@@ -519,6 +520,7 @@ enum utf8_state {
#define GRID_ATTR_HIDDEN 0x20
#define GRID_ATTR_ITALICS 0x40
#define GRID_ATTR_CHARSET 0x80 /* alternative character set */
+#define GRID_ATTR_STRIKETHROUGH 0x100
/* Grid flags. */
#define GRID_FLAG_FG256 0x1
@@ -535,7 +537,7 @@ enum utf8_state {
/* Grid cell data. */
struct grid_cell {
u_char flags;
- u_char attr;
+ u_short attr;
int fg;
int bg;
struct utf8_data data;
@@ -1913,7 +1915,7 @@ int colour_fromstring(const char *s);
u_char colour_256to16(u_char);
/* attributes.c */
-const char *attributes_tostring(u_char);
+const char *attributes_tostring(int);
int attributes_fromstring(const char *);
/* grid.c */
diff --git a/tty-term.c b/tty-term.c
index 525f03d6..b8a25de5 100644
--- a/tty-term.c
+++ b/tty-term.c
@@ -252,6 +252,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" },
[TTYC_SMSO] = { TTYCODE_STRING, "smso" },
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
+ [TTYC_SMXX] = { TTYCODE_STRING, "smxx" },
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
[TTYC_TC] = { TTYCODE_FLAG, "Tc" },
[TTYC_TSL] = { TTYCODE_STRING, "tsl" },
diff --git a/tty.c b/tty.c
index 03e4686b..8792da70 100644
--- a/tty.c
+++ b/tty.c
@@ -1557,7 +1557,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
const struct window_pane *wp)
{
struct grid_cell *tc = &tty->cell, gc2;
- u_char changed;
+ int changed;
/* Ignore cell if it is the same as the last one. */
if (wp != NULL &&
@@ -1627,6 +1627,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
}
if (changed & GRID_ATTR_HIDDEN)
tty_putcode(tty, TTYC_INVIS);
+ if (changed & GRID_ATTR_STRIKETHROUGH)
+ tty_putcode(tty, TTYC_SMXX);
if ((changed & GRID_ATTR_CHARSET) && tty_use_acs(tty))
tty_putcode(tty, TTYC_SMACS);
}