diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-05-07 13:39:10 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2018-05-07 13:39:10 +0000 |
commit | 5614b8ad61e8c13faa22e01c444b27fcf7ec29d9 (patch) | |
tree | 815ed0edf589a5700f4b1b1514710e11a63ee3ef /usr.bin | |
parent | 0ad1afcca1c8f1c217e06fb4b08c3bad617c14c4 (diff) |
Handle terminfo colors > 256 correctly, GitHub issue 1337.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/tmux/tty-term.c | 7 | ||||
-rw-r--r-- | usr.bin/tmux/tty.c | 8 |
2 files changed, 7 insertions, 8 deletions
diff --git a/usr.bin/tmux/tty-term.c b/usr.bin/tmux/tty-term.c index 22fff90b52a..6c965147411 100644 --- a/usr.bin/tmux/tty-term.c +++ b/usr.bin/tmux/tty-term.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty-term.c,v 1.58 2018/02/04 10:10:39 nicm Exp $ */ +/* $OpenBSD: tty-term.c,v 1.59 2018/05/07 13:39:09 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -488,8 +488,9 @@ tty_term_find(char *name, int fd, char **cause) goto error; } - /* Figure out if we have 256. */ - if (tty_term_number(term, TTYC_COLORS) == 256) + /* Figure out if we have 256 colours (or more). */ + if (tty_term_number(term, TTYC_COLORS) >= 256 || + tty_term_has(term, TTYC_RGB)) term->flags |= TERM_256COLOURS; /* diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 03c3d6fe0f5..5caa08b2931 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.301 2018/04/23 07:41:30 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.302 2018/05/07 13:39:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -2000,8 +2000,7 @@ tty_colours_fg(struct tty *tty, const struct grid_cell *gc) char s[32]; /* 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) goto save_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]; /* 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) goto save_bg; /* Should not get here, already converted in tty_check_bg. */ |