mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00:00
Handle terminfo colors > 256 correctly, GitHub issue 1337.
This commit is contained in:
parent
988c6bc433
commit
f915a4bf0c
@ -488,8 +488,9 @@ tty_term_find(char *name, int fd, char **cause)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Figure out if we have 256. */
|
/* Figure out if we have 256 colours (or more). */
|
||||||
if (tty_term_number(term, TTYC_COLORS) == 256)
|
if (tty_term_number(term, TTYC_COLORS) >= 256 ||
|
||||||
|
tty_term_has(term, TTYC_RGB))
|
||||||
term->flags |= TERM_256COLOURS;
|
term->flags |= TERM_256COLOURS;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
6
tty.c
6
tty.c
@ -2000,8 +2000,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
char s[32];
|
char s[32];
|
||||||
|
|
||||||
/* Is this a 24-bit or 256-colour colour? */
|
/* Is this a 24-bit or 256-colour colour? */
|
||||||
if (gc->fg & COLOUR_FLAG_RGB ||
|
if (gc->fg & COLOUR_FLAG_RGB || gc->fg & COLOUR_FLAG_256) {
|
||||||
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_fg;
|
||||||
/* Should not get here, already converted in tty_check_fg. */
|
/* Should not get here, already converted in tty_check_fg. */
|
||||||
@ -2030,8 +2029,7 @@ tty_colours_bg(struct tty *tty, const struct grid_cell *gc)
|
|||||||
char s[32];
|
char s[32];
|
||||||
|
|
||||||
/* Is this a 24-bit or 256-colour colour? */
|
/* Is this a 24-bit or 256-colour colour? */
|
||||||
if (gc->bg & COLOUR_FLAG_RGB ||
|
if (gc->bg & COLOUR_FLAG_RGB || gc->bg & COLOUR_FLAG_256) {
|
||||||
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_bg;
|
||||||
/* Should not get here, already converted in tty_check_bg. */
|
/* Should not get here, already converted in tty_check_bg. */
|
||||||
|
Loading…
Reference in New Issue
Block a user