mirror of
https://github.com/tmux/tmux.git
synced 2024-11-17 18:08:51 +00:00
Use the setal capability as well as (tmux's) Setulc.
This commit is contained in:
parent
f2dfc2759e
commit
c8f3736b07
4
tmux.1
4
tmux.1
@ -5897,8 +5897,8 @@ Set a styled underscore.
|
|||||||
The single parameter is one of: 0 for no underscore, 1 for normal
|
The single parameter is one of: 0 for no underscore, 1 for normal
|
||||||
underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
|
underscore, 2 for double underscore, 3 for curly underscore, 4 for dotted
|
||||||
underscore and 5 for dashed underscore.
|
underscore and 5 for dashed underscore.
|
||||||
.It Em \&Setulc
|
.It Em \&Setulc , \&ol
|
||||||
Set the underscore colour.
|
Set the underscore colour or reset to the default.
|
||||||
The argument is (red * 65536) + (green * 256) + blue where each is between 0
|
The argument is (red * 65536) + (green * 256) + blue where each is between 0
|
||||||
and 255.
|
and 255.
|
||||||
.It Em \&Ss , Se
|
.It Em \&Ss , Se
|
||||||
|
2
tmux.h
2
tmux.h
@ -448,6 +448,7 @@ enum tty_code_code {
|
|||||||
TTYC_KUP6,
|
TTYC_KUP6,
|
||||||
TTYC_KUP7,
|
TTYC_KUP7,
|
||||||
TTYC_MS,
|
TTYC_MS,
|
||||||
|
TTYC_OL,
|
||||||
TTYC_OP,
|
TTYC_OP,
|
||||||
TTYC_REV,
|
TTYC_REV,
|
||||||
TTYC_RGB,
|
TTYC_RGB,
|
||||||
@ -459,6 +460,7 @@ enum tty_code_code {
|
|||||||
TTYC_SE,
|
TTYC_SE,
|
||||||
TTYC_SETAB,
|
TTYC_SETAB,
|
||||||
TTYC_SETAF,
|
TTYC_SETAF,
|
||||||
|
TTYC_SETAL,
|
||||||
TTYC_SETRGBB,
|
TTYC_SETRGBB,
|
||||||
TTYC_SETRGBF,
|
TTYC_SETRGBF,
|
||||||
TTYC_SETULC,
|
TTYC_SETULC,
|
||||||
|
@ -112,6 +112,7 @@ static const struct tty_feature tty_feature_overline = {
|
|||||||
static const char *tty_feature_usstyle_capabilities[] = {
|
static const char *tty_feature_usstyle_capabilities[] = {
|
||||||
"Smulx=\\E[4::%p1%dm",
|
"Smulx=\\E[4::%p1%dm",
|
||||||
"Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m",
|
"Setulc=\\E[58::2::%p1%{65536}%/%d::%p1%{256}%/%{255}%&%d::%p1%{255}%&%d%;m",
|
||||||
|
"ol=\\E[59m",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
static const struct tty_feature tty_feature_usstyle = {
|
static const struct tty_feature tty_feature_usstyle = {
|
||||||
@ -336,7 +337,7 @@ tty_default_features(int *feat, const char *name, u_int version)
|
|||||||
"256,RGB,bpaste,clipboard,strikethrough,title"
|
"256,RGB,bpaste,clipboard,strikethrough,title"
|
||||||
{ .name = "mintty",
|
{ .name = "mintty",
|
||||||
.features = TTY_FEATURES_BASE_MODERN_XTERM
|
.features = TTY_FEATURES_BASE_MODERN_XTERM
|
||||||
",ccolour,cstyle,extkeys,margins,overline"
|
",ccolour,cstyle,extkeys,margins,overline,usstyle"
|
||||||
},
|
},
|
||||||
{ .name = "tmux",
|
{ .name = "tmux",
|
||||||
.features = TTY_FEATURES_BASE_MODERN_XTERM
|
.features = TTY_FEATURES_BASE_MODERN_XTERM
|
||||||
|
@ -245,6 +245,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||||||
[TTYC_KUP6] = { TTYCODE_STRING, "kUP6" },
|
[TTYC_KUP6] = { TTYCODE_STRING, "kUP6" },
|
||||||
[TTYC_KUP7] = { TTYCODE_STRING, "kUP7" },
|
[TTYC_KUP7] = { TTYCODE_STRING, "kUP7" },
|
||||||
[TTYC_MS] = { TTYCODE_STRING, "Ms" },
|
[TTYC_MS] = { TTYCODE_STRING, "Ms" },
|
||||||
|
[TTYC_OL] = { TTYCODE_STRING, "ol" },
|
||||||
[TTYC_OP] = { TTYCODE_STRING, "op" },
|
[TTYC_OP] = { TTYCODE_STRING, "op" },
|
||||||
[TTYC_REV] = { TTYCODE_STRING, "rev" },
|
[TTYC_REV] = { TTYCODE_STRING, "rev" },
|
||||||
[TTYC_RGB] = { TTYCODE_FLAG, "RGB" },
|
[TTYC_RGB] = { TTYCODE_FLAG, "RGB" },
|
||||||
@ -255,6 +256,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||||||
[TTYC_RMKX] = { TTYCODE_STRING, "rmkx" },
|
[TTYC_RMKX] = { TTYCODE_STRING, "rmkx" },
|
||||||
[TTYC_SETAB] = { TTYCODE_STRING, "setab" },
|
[TTYC_SETAB] = { TTYCODE_STRING, "setab" },
|
||||||
[TTYC_SETAF] = { TTYCODE_STRING, "setaf" },
|
[TTYC_SETAF] = { TTYCODE_STRING, "setaf" },
|
||||||
|
[TTYC_SETAL] = { TTYCODE_STRING, "setal" },
|
||||||
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
|
[TTYC_SETRGBB] = { TTYCODE_STRING, "setrgbb" },
|
||||||
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
|
[TTYC_SETRGBF] = { TTYCODE_STRING, "setrgbf" },
|
||||||
[TTYC_SETULC] = { TTYCODE_STRING, "Setulc" },
|
[TTYC_SETULC] = { TTYCODE_STRING, "Setulc" },
|
||||||
|
30
tty.c
30
tty.c
@ -2543,7 +2543,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
/* Is this a 24-bit or 256-colour colour? */
|
/* Is this a 24-bit or 256-colour colour? */
|
||||||
if (gc->fg & COLOUR_FLAG_RGB || gc->fg & COLOUR_FLAG_256) {
|
if (gc->fg & COLOUR_FLAG_RGB || gc->fg & COLOUR_FLAG_256) {
|
||||||
if (tty_try_colour(tty, gc->fg, "38") == 0)
|
if (tty_try_colour(tty, gc->fg, "38") == 0)
|
||||||
goto save_fg;
|
goto save;
|
||||||
/* Should not get here, already converted in tty_check_fg. */
|
/* Should not get here, already converted in tty_check_fg. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2555,13 +2555,13 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
tty_puts(tty, s);
|
tty_puts(tty, s);
|
||||||
} else
|
} else
|
||||||
tty_putcode1(tty, TTYC_SETAF, gc->fg - 90 + 8);
|
tty_putcode1(tty, TTYC_SETAF, gc->fg - 90 + 8);
|
||||||
goto save_fg;
|
goto save;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise set the foreground colour. */
|
/* Otherwise set the foreground colour. */
|
||||||
tty_putcode1(tty, TTYC_SETAF, gc->fg);
|
tty_putcode1(tty, TTYC_SETAF, gc->fg);
|
||||||
|
|
||||||
save_fg:
|
save:
|
||||||
/* Save the new values in the terminal current cell. */
|
/* Save the new values in the terminal current cell. */
|
||||||
tc->fg = gc->fg;
|
tc->fg = gc->fg;
|
||||||
}
|
}
|
||||||
@ -2575,7 +2575,7 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
/* Is this a 24-bit or 256-colour colour? */
|
/* Is this a 24-bit or 256-colour colour? */
|
||||||
if (gc->bg & COLOUR_FLAG_RGB || gc->bg & COLOUR_FLAG_256) {
|
if (gc->bg & COLOUR_FLAG_RGB || gc->bg & COLOUR_FLAG_256) {
|
||||||
if (tty_try_colour(tty, gc->bg, "48") == 0)
|
if (tty_try_colour(tty, gc->bg, "48") == 0)
|
||||||
goto save_bg;
|
goto save;
|
||||||
/* Should not get here, already converted in tty_check_bg. */
|
/* Should not get here, already converted in tty_check_bg. */
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2587,13 +2587,13 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
tty_puts(tty, s);
|
tty_puts(tty, s);
|
||||||
} else
|
} else
|
||||||
tty_putcode1(tty, TTYC_SETAB, gc->bg - 90 + 8);
|
tty_putcode1(tty, TTYC_SETAB, gc->bg - 90 + 8);
|
||||||
goto save_bg;
|
goto save;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise set the background colour. */
|
/* Otherwise set the background colour. */
|
||||||
tty_putcode1(tty, TTYC_SETAB, gc->bg);
|
tty_putcode1(tty, TTYC_SETAB, gc->bg);
|
||||||
|
|
||||||
save_bg:
|
save:
|
||||||
/* Save the new values in the terminal current cell. */
|
/* Save the new values in the terminal current cell. */
|
||||||
tc->bg = gc->bg;
|
tc->bg = gc->bg;
|
||||||
}
|
}
|
||||||
@ -2605,20 +2605,34 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc)
|
|||||||
u_int c;
|
u_int c;
|
||||||
u_char r, g, b;
|
u_char r, g, b;
|
||||||
|
|
||||||
|
/* Clear underline colour. */
|
||||||
|
if (gc->us == 0) {
|
||||||
|
tty_putcode(tty, TTYC_OL);
|
||||||
|
goto save;
|
||||||
|
}
|
||||||
|
|
||||||
/* Must be an RGB colour - this should never happen. */
|
/* Must be an RGB colour - this should never happen. */
|
||||||
if (~gc->us & COLOUR_FLAG_RGB)
|
if (~gc->us & COLOUR_FLAG_RGB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setulc follows the ncurses(3) one argument "direct colour"
|
* Setulc and setal follows the ncurses(3) one argument "direct colour"
|
||||||
* capability format. Calculate the colour value.
|
* capability format. Calculate the colour value.
|
||||||
*/
|
*/
|
||||||
colour_split_rgb(gc->us, &r, &g, &b);
|
colour_split_rgb(gc->us, &r, &g, &b);
|
||||||
c = (65536 * r) + (256 * g) + b;
|
c = (65536 * r) + (256 * g) + b;
|
||||||
|
|
||||||
/* Write the colour. */
|
/*
|
||||||
|
* Write the colour. Only use setal if the RGB flag is set because the
|
||||||
|
* non-RGB version may be wrong.
|
||||||
|
*/
|
||||||
|
if (tty_term_has(tty->term, TTYC_SETULC))
|
||||||
tty_putcode1(tty, TTYC_SETULC, c);
|
tty_putcode1(tty, TTYC_SETULC, c);
|
||||||
|
else if (tty_term_has(tty->term, TTYC_SETAL) &&
|
||||||
|
tty_term_has(tty->term, TTYC_RGB))
|
||||||
|
tty_putcode1(tty, TTYC_SETAL, c);
|
||||||
|
|
||||||
|
save:
|
||||||
/* Save the new values in the terminal current cell. */
|
/* Save the new values in the terminal current cell. */
|
||||||
tc->us = gc->us;
|
tc->us = gc->us;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user