Merge branch 'master' of github.com:tmux/tmux

This commit is contained in:
Nicholas Marriott 2017-03-22 08:46:12 +00:00
commit 9c0520f2c5
8 changed files with 29 additions and 13 deletions

View File

@ -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);

5
grid.c
View File

@ -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;

View File

@ -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:

View File

@ -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);

3
tmux.1
View File

@ -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.

8
tmux.h
View File

@ -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 */

View File

@ -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" },

4
tty.c
View File

@ -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);
}