mirror of
https://github.com/tmux/tmux.git
synced 2024-11-18 02:18:53 +00:00
Setulc only does RGB colour so add Setulc1 to do non-RGB colours, GitHub
issue 3627.
This commit is contained in:
parent
c5542637d7
commit
d209fe9b1e
10
tmux.1
10
tmux.1
@ -6802,9 +6802,15 @@ 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 , \&ol
|
.It Em \&Setulc , \&Setulc1, \&ol
|
||||||
Set the underscore colour or reset to the default.
|
Set the underscore colour or reset to the default.
|
||||||
The argument is (red * 65536) + (green * 256) + blue where each is between 0
|
.Em Setulc
|
||||||
|
is for RGB colours and
|
||||||
|
.Em Setulc1
|
||||||
|
for ANSI or 256 colours.
|
||||||
|
The
|
||||||
|
.Em Setulc
|
||||||
|
argument is (red * 65536) + (green * 256) + blue where each is between 0
|
||||||
and 255.
|
and 255.
|
||||||
.It Em \&Ss , Se
|
.It Em \&Ss , Se
|
||||||
Set or reset the cursor style.
|
Set or reset the cursor style.
|
||||||
|
1
tmux.h
1
tmux.h
@ -536,6 +536,7 @@ enum tty_code_code {
|
|||||||
TTYC_SETRGBB,
|
TTYC_SETRGBB,
|
||||||
TTYC_SETRGBF,
|
TTYC_SETRGBF,
|
||||||
TTYC_SETULC,
|
TTYC_SETULC,
|
||||||
|
TTYC_SETULC1,
|
||||||
TTYC_SGR0,
|
TTYC_SGR0,
|
||||||
TTYC_SITM,
|
TTYC_SITM,
|
||||||
TTYC_SMACS,
|
TTYC_SMACS,
|
||||||
|
@ -145,6 +145,7 @@ static const struct tty_feature tty_feature_overline = {
|
|||||||
static const char *const tty_feature_usstyle_capabilities[] = {
|
static const char *const 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",
|
||||||
|
"Setulc1=\\E[58::5::%p1%dm",
|
||||||
"ol=\\E[59m",
|
"ol=\\E[59m",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
@ -264,6 +264,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
|
|||||||
[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" },
|
||||||
|
[TTYC_SETULC1] = { TTYCODE_STRING, "Setulc1" },
|
||||||
[TTYC_SE] = { TTYCODE_STRING, "Se" },
|
[TTYC_SE] = { TTYCODE_STRING, "Se" },
|
||||||
[TTYC_SXL] = { TTYCODE_FLAG, "Sxl" },
|
[TTYC_SXL] = { TTYCODE_FLAG, "Sxl" },
|
||||||
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
|
[TTYC_SGR0] = { TTYCODE_STRING, "sgr0" },
|
||||||
|
16
tty.c
16
tty.c
@ -2814,11 +2814,13 @@ tty_check_us(__unused struct tty *tty, struct colour_palette *palette,
|
|||||||
gc->us = c;
|
gc->us = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Underscore colour is set as RGB so convert. */
|
/* Convert underscore colour if only RGB can be supported. */
|
||||||
|
if (!tty_term_has(tty->term, TTYC_SETULC1)) {
|
||||||
if ((c = colour_force_rgb (gc->us)) == -1)
|
if ((c = colour_force_rgb (gc->us)) == -1)
|
||||||
gc->us = 8;
|
gc->us = 8;
|
||||||
else
|
else
|
||||||
gc->us = c;
|
gc->us = c;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2898,9 +2900,17 @@ tty_colours_us(struct tty *tty, const struct grid_cell *gc)
|
|||||||
goto save;
|
goto save;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Must be an RGB colour - this should never happen. */
|
/*
|
||||||
if (~gc->us & COLOUR_FLAG_RGB)
|
* If this is not an RGB colour, use Setulc1 if it exists, otherwise
|
||||||
|
* convert.
|
||||||
|
*/
|
||||||
|
if (~gc->us & COLOUR_FLAG_RGB) {
|
||||||
|
c = gc->us;
|
||||||
|
if ((~c & COLOUR_FLAG_256) && (c >= 90 && c <= 97))
|
||||||
|
c -= 82;
|
||||||
|
tty_putcode_i(tty, TTYC_SETULC1, c & ~COLOUR_FLAG_256);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Setulc and setal follows the ncurses(3) one argument "direct colour"
|
* Setulc and setal follows the ncurses(3) one argument "direct colour"
|
||||||
|
Loading…
Reference in New Issue
Block a user