Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2018-02-04 12:02:24 +00:00
commit 24abfb72eb
3 changed files with 16 additions and 6 deletions

1
tmux.h
View File

@ -403,6 +403,7 @@ enum tty_code_code {
TTYC_MS, TTYC_MS,
TTYC_OP, TTYC_OP,
TTYC_REV, TTYC_REV,
TTYC_RGB,
TTYC_RI, TTYC_RI,
TTYC_RMACS, TTYC_RMACS,
TTYC_RMCUP, TTYC_RMCUP,

View File

@ -240,6 +240,7 @@ static const struct tty_term_code_entry tty_term_codes[] = {
[TTYC_MS] = { TTYCODE_STRING, "Ms" }, [TTYC_MS] = { TTYCODE_STRING, "Ms" },
[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_RI] = { TTYCODE_STRING, "ri" }, [TTYC_RI] = { TTYCODE_STRING, "ri" },
[TTYC_RMACS] = { TTYCODE_STRING, "rmacs" }, [TTYC_RMACS] = { TTYCODE_STRING, "rmacs" },
[TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" }, [TTYC_RMCUP] = { TTYCODE_STRING, "rmcup" },
@ -531,8 +532,11 @@ tty_term_find(char *name, int fd, char **cause)
code->type = TTYCODE_STRING; code->type = TTYCODE_STRING;
} }
/* On terminals with RGB colour (TC), fill in setrgbf and setrgbb. */ /*
if (tty_term_flag(term, TTYC_TC) && * On terminals with RGB colour (Tc or RGB), fill in setrgbf and
* setrgbb if they are missing.
*/
if ((tty_term_flag(term, TTYC_TC) || tty_term_flag(term, TTYC_RGB)) &&
!tty_term_has(term, TTYC_SETRGBF) && !tty_term_has(term, TTYC_SETRGBF) &&
!tty_term_has(term, TTYC_SETRGBB)) { !tty_term_has(term, TTYC_SETRGBB)) {
code = &term->codes[TTYC_SETRGBF]; code = &term->codes[TTYC_SETRGBF];

13
tty.c
View File

@ -2051,11 +2051,15 @@ tty_try_colour(struct tty *tty, int colour, const char *type)
if (colour & COLOUR_FLAG_256) { if (colour & COLOUR_FLAG_256) {
/* /*
* If the user has specified -2 to the client, setaf and setab * If the user has specified -2 to the client (meaning
* may not work (or they may not want to use them), so send the * TERM_256COLOURS is set), setaf and setab may not work (or
* usual sequence. * they may not want to use them), so send the usual sequence.
*
* Also if RGB is set, setaf and setab do not support the 256
* colour palette so use the sequences directly there too.
*/ */
if (tty->term_flags & TERM_256COLOURS) if ((tty->term_flags & TERM_256COLOURS) ||
tty_term_has(tty->term, TTYC_RGB))
goto fallback_256; goto fallback_256;
/* /*
@ -2096,6 +2100,7 @@ tty_try_colour(struct tty *tty, int colour, const char *type)
fallback_256: fallback_256:
xsnprintf(s, sizeof s, "\033[%s;5;%dm", type, colour & 0xff); xsnprintf(s, sizeof s, "\033[%s;5;%dm", type, colour & 0xff);
log_debug("%s: 256 colour fallback: %s", tty->client->name, s);
tty_puts(tty, s); tty_puts(tty, s);
return (0); return (0);
} }