mirror of
https://github.com/tmux/tmux.git
synced 2024-11-05 10:28:48 +00:00
Merge branch 'master' of github.com:tmux/tmux
This commit is contained in:
commit
9c0520f2c5
11
attributes.c
11
attributes.c
@ -23,7 +23,7 @@
|
|||||||
#include "tmux.h"
|
#include "tmux.h"
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
attributes_tostring(u_char attr)
|
attributes_tostring(int attr)
|
||||||
{
|
{
|
||||||
static char buf[128];
|
static char buf[128];
|
||||||
size_t len;
|
size_t len;
|
||||||
@ -31,14 +31,15 @@ attributes_tostring(u_char attr)
|
|||||||
if (attr == 0)
|
if (attr == 0)
|
||||||
return ("none");
|
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_BRIGHT) ? "bright," : "",
|
||||||
(attr & GRID_ATTR_DIM) ? "dim," : "",
|
(attr & GRID_ATTR_DIM) ? "dim," : "",
|
||||||
(attr & GRID_ATTR_UNDERSCORE) ? "underscore," : "",
|
(attr & GRID_ATTR_UNDERSCORE) ? "underscore," : "",
|
||||||
(attr & GRID_ATTR_BLINK)? "blink," : "",
|
(attr & GRID_ATTR_BLINK)? "blink," : "",
|
||||||
(attr & GRID_ATTR_REVERSE) ? "reverse," : "",
|
(attr & GRID_ATTR_REVERSE) ? "reverse," : "",
|
||||||
(attr & GRID_ATTR_HIDDEN) ? "hidden," : "",
|
(attr & GRID_ATTR_HIDDEN) ? "hidden," : "",
|
||||||
(attr & GRID_ATTR_ITALICS) ? "italics," : "");
|
(attr & GRID_ATTR_ITALICS) ? "italics," : "",
|
||||||
|
(attr & GRID_ATTR_STRIKETHROUGH) ? "strikethrough," : "");
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
buf[len - 1] = '\0';
|
buf[len - 1] = '\0';
|
||||||
|
|
||||||
@ -49,7 +50,7 @@ int
|
|||||||
attributes_fromstring(const char *str)
|
attributes_fromstring(const char *str)
|
||||||
{
|
{
|
||||||
const char delimiters[] = " ,|";
|
const char delimiters[] = " ,|";
|
||||||
u_char attr;
|
int attr;
|
||||||
size_t end;
|
size_t end;
|
||||||
|
|
||||||
if (*str == '\0' || strcspn(str, delimiters) == 0)
|
if (*str == '\0' || strcspn(str, delimiters) == 0)
|
||||||
@ -78,6 +79,8 @@ attributes_fromstring(const char *str)
|
|||||||
attr |= GRID_ATTR_HIDDEN;
|
attr |= GRID_ATTR_HIDDEN;
|
||||||
else if (end == 7 && strncasecmp(str, "italics", end) == 0)
|
else if (end == 7 && strncasecmp(str, "italics", end) == 0)
|
||||||
attr |= GRID_ATTR_ITALICS;
|
attr |= GRID_ATTR_ITALICS;
|
||||||
|
else if (end == 13 && strncasecmp(str, "strikethrough", end) == 0)
|
||||||
|
attr |= GRID_ATTR_STRIKETHROUGH;
|
||||||
else
|
else
|
||||||
return (-1);
|
return (-1);
|
||||||
str += end + strspn(str + end, delimiters);
|
str += end + strspn(str + end, delimiters);
|
||||||
|
5
grid.c
5
grid.c
@ -85,6 +85,8 @@ grid_need_extended_cell(const struct grid_cell_entry *gce,
|
|||||||
{
|
{
|
||||||
if (gce->flags & GRID_FLAG_EXTENDED)
|
if (gce->flags & GRID_FLAG_EXTENDED)
|
||||||
return (1);
|
return (1);
|
||||||
|
if (gc->attr > 0xff)
|
||||||
|
return (1);
|
||||||
if (gc->data.size != 1 || gc->data.width != 1)
|
if (gc->data.size != 1 || gc->data.width != 1)
|
||||||
return (1);
|
return (1);
|
||||||
if ((gc->fg & COLOUR_FLAG_RGB) ||(gc->bg & COLOUR_FLAG_RGB))
|
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_UNDERSCORE, 4 },
|
||||||
{ GRID_ATTR_BLINK, 5 },
|
{ GRID_ATTR_BLINK, 5 },
|
||||||
{ GRID_ATTR_REVERSE, 7 },
|
{ GRID_ATTR_REVERSE, 7 },
|
||||||
{ GRID_ATTR_HIDDEN, 8 }
|
{ GRID_ATTR_HIDDEN, 8 },
|
||||||
|
{ GRID_ATTR_STRIKETHROUGH, 9 }
|
||||||
};
|
};
|
||||||
n = 0;
|
n = 0;
|
||||||
|
|
||||||
|
6
input.c
6
input.c
@ -1764,6 +1764,9 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
|
|||||||
case 8:
|
case 8:
|
||||||
gc->attr |= GRID_ATTR_HIDDEN;
|
gc->attr |= GRID_ATTR_HIDDEN;
|
||||||
break;
|
break;
|
||||||
|
case 9:
|
||||||
|
gc->attr |= GRID_ATTR_STRIKETHROUGH;
|
||||||
|
break;
|
||||||
case 22:
|
case 22:
|
||||||
gc->attr &= ~(GRID_ATTR_BRIGHT|GRID_ATTR_DIM);
|
gc->attr &= ~(GRID_ATTR_BRIGHT|GRID_ATTR_DIM);
|
||||||
break;
|
break;
|
||||||
@ -1782,6 +1785,9 @@ input_csi_dispatch_sgr(struct input_ctx *ictx)
|
|||||||
case 28:
|
case 28:
|
||||||
gc->attr &= ~GRID_ATTR_HIDDEN;
|
gc->attr &= ~GRID_ATTR_HIDDEN;
|
||||||
break;
|
break;
|
||||||
|
case 29:
|
||||||
|
gc->attr &= ~GRID_ATTR_STRIKETHROUGH;
|
||||||
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
case 31:
|
case 31:
|
||||||
case 32:
|
case 32:
|
||||||
|
4
style.c
4
style.c
@ -31,10 +31,8 @@ style_parse(const struct grid_cell *defgc, struct grid_cell *gc,
|
|||||||
struct grid_cell savedgc;
|
struct grid_cell savedgc;
|
||||||
const char delimiters[] = " ,";
|
const char delimiters[] = " ,";
|
||||||
char tmp[32];
|
char tmp[32];
|
||||||
int val;
|
int val, fg, bg, attr, flags;
|
||||||
size_t end;
|
size_t end;
|
||||||
int fg, bg;
|
|
||||||
u_char attr, flags;
|
|
||||||
|
|
||||||
if (*in == '\0')
|
if (*in == '\0')
|
||||||
return (0);
|
return (0);
|
||||||
|
3
tmux.1
3
tmux.1
@ -2668,8 +2668,9 @@ or a comma-delimited list of one or more of:
|
|||||||
.Ic blink ,
|
.Ic blink ,
|
||||||
.Ic reverse ,
|
.Ic reverse ,
|
||||||
.Ic hidden ,
|
.Ic hidden ,
|
||||||
or
|
|
||||||
.Ic italics ,
|
.Ic italics ,
|
||||||
|
or
|
||||||
|
.Ic strikethrough
|
||||||
to turn an attribute on, or an attribute prefixed with
|
to turn an attribute on, or an attribute prefixed with
|
||||||
.Ql no
|
.Ql no
|
||||||
to turn one off.
|
to turn one off.
|
||||||
|
8
tmux.h
8
tmux.h
@ -399,6 +399,7 @@ enum tty_code_code {
|
|||||||
TTYC_SMKX, /* keypad_xmit, ks */
|
TTYC_SMKX, /* keypad_xmit, ks */
|
||||||
TTYC_SMSO, /* enter_standout_mode, so */
|
TTYC_SMSO, /* enter_standout_mode, so */
|
||||||
TTYC_SMUL, /* enter_underline_mode, us */
|
TTYC_SMUL, /* enter_underline_mode, us */
|
||||||
|
TTYC_SMXX,
|
||||||
TTYC_SS, /* set cursor style, Ss */
|
TTYC_SS, /* set cursor style, Ss */
|
||||||
TTYC_TC, /* 24-bit "true" colour, Tc */
|
TTYC_TC, /* 24-bit "true" colour, Tc */
|
||||||
TTYC_TSL, /* to_status_line, tsl */
|
TTYC_TSL, /* to_status_line, tsl */
|
||||||
@ -510,7 +511,7 @@ enum utf8_state {
|
|||||||
#define COLOUR_FLAG_256 0x01000000
|
#define COLOUR_FLAG_256 0x01000000
|
||||||
#define COLOUR_FLAG_RGB 0x02000000
|
#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_BRIGHT 0x1
|
||||||
#define GRID_ATTR_DIM 0x2
|
#define GRID_ATTR_DIM 0x2
|
||||||
#define GRID_ATTR_UNDERSCORE 0x4
|
#define GRID_ATTR_UNDERSCORE 0x4
|
||||||
@ -519,6 +520,7 @@ enum utf8_state {
|
|||||||
#define GRID_ATTR_HIDDEN 0x20
|
#define GRID_ATTR_HIDDEN 0x20
|
||||||
#define GRID_ATTR_ITALICS 0x40
|
#define GRID_ATTR_ITALICS 0x40
|
||||||
#define GRID_ATTR_CHARSET 0x80 /* alternative character set */
|
#define GRID_ATTR_CHARSET 0x80 /* alternative character set */
|
||||||
|
#define GRID_ATTR_STRIKETHROUGH 0x100
|
||||||
|
|
||||||
/* Grid flags. */
|
/* Grid flags. */
|
||||||
#define GRID_FLAG_FG256 0x1
|
#define GRID_FLAG_FG256 0x1
|
||||||
@ -535,7 +537,7 @@ enum utf8_state {
|
|||||||
/* Grid cell data. */
|
/* Grid cell data. */
|
||||||
struct grid_cell {
|
struct grid_cell {
|
||||||
u_char flags;
|
u_char flags;
|
||||||
u_char attr;
|
u_short attr;
|
||||||
int fg;
|
int fg;
|
||||||
int bg;
|
int bg;
|
||||||
struct utf8_data data;
|
struct utf8_data data;
|
||||||
@ -1913,7 +1915,7 @@ int colour_fromstring(const char *s);
|
|||||||
u_char colour_256to16(u_char);
|
u_char colour_256to16(u_char);
|
||||||
|
|
||||||
/* attributes.c */
|
/* attributes.c */
|
||||||
const char *attributes_tostring(u_char);
|
const char *attributes_tostring(int);
|
||||||
int attributes_fromstring(const char *);
|
int attributes_fromstring(const char *);
|
||||||
|
|
||||||
/* grid.c */
|
/* grid.c */
|
||||||
|
@ -252,6 +252,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||||||
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" },
|
[TTYC_SMKX] = { TTYCODE_STRING, "smkx" },
|
||||||
[TTYC_SMSO] = { TTYCODE_STRING, "smso" },
|
[TTYC_SMSO] = { TTYCODE_STRING, "smso" },
|
||||||
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
|
[TTYC_SMUL] = { TTYCODE_STRING, "smul" },
|
||||||
|
[TTYC_SMXX] = { TTYCODE_STRING, "smxx" },
|
||||||
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
|
[TTYC_SS] = { TTYCODE_STRING, "Ss" },
|
||||||
[TTYC_TC] = { TTYCODE_FLAG, "Tc" },
|
[TTYC_TC] = { TTYCODE_FLAG, "Tc" },
|
||||||
[TTYC_TSL] = { TTYCODE_STRING, "tsl" },
|
[TTYC_TSL] = { TTYCODE_STRING, "tsl" },
|
||||||
|
4
tty.c
4
tty.c
@ -1557,7 +1557,7 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
|||||||
const struct window_pane *wp)
|
const struct window_pane *wp)
|
||||||
{
|
{
|
||||||
struct grid_cell *tc = &tty->cell, gc2;
|
struct grid_cell *tc = &tty->cell, gc2;
|
||||||
u_char changed;
|
int changed;
|
||||||
|
|
||||||
/* Ignore cell if it is the same as the last one. */
|
/* Ignore cell if it is the same as the last one. */
|
||||||
if (wp != NULL &&
|
if (wp != NULL &&
|
||||||
@ -1627,6 +1627,8 @@ tty_attributes(struct tty *tty, const struct grid_cell *gc,
|
|||||||
}
|
}
|
||||||
if (changed & GRID_ATTR_HIDDEN)
|
if (changed & GRID_ATTR_HIDDEN)
|
||||||
tty_putcode(tty, TTYC_INVIS);
|
tty_putcode(tty, TTYC_INVIS);
|
||||||
|
if (changed & GRID_ATTR_STRIKETHROUGH)
|
||||||
|
tty_putcode(tty, TTYC_SMXX);
|
||||||
if ((changed & GRID_ATTR_CHARSET) && tty_use_acs(tty))
|
if ((changed & GRID_ATTR_CHARSET) && tty_use_acs(tty))
|
||||||
tty_putcode(tty, TTYC_SMACS);
|
tty_putcode(tty, TTYC_SMACS);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user