diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-12 00:30:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-01-12 00:30:42 +0000 |
commit | 84ab6fed217b5af39e3ad89b6714507d0815b1b9 (patch) | |
tree | 3ccf868f2d177985a38bab998de2364983b84283 /usr.bin/tmux | |
parent | cffb20febef79bc622b9ad56e99ad146d9db418b (diff) |
aixterm colours can be used if -2 is given, as well as if TERM tells us
the terminal has >=16 colours.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/tty.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c index 6093f9ccbec..6ed4a31d963 100644 --- a/usr.bin/tmux/tty.c +++ b/usr.bin/tmux/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.223 2017/01/12 00:19:32 nicm Exp $ */ +/* $OpenBSD: tty.c,v 1.224 2017/01/12 00:30:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1625,13 +1625,17 @@ tty_check_fg(struct tty *tty, const struct window_pane *wp, } else return; } - colours = tty_term_number(tty->term, TTYC_COLORS); + + /* How many colours does this terminal have? */ + if ((tty->term->flags|tty->term_flags) & TERM_256COLOURS) + colours = 256; + else + colours = tty_term_number(tty->term, TTYC_COLORS); /* Is this a 256-colour colour? */ if (gc->fg & COLOUR_FLAG_256) { /* And not a 256 colour mode? */ - if (!(tty->term->flags & TERM_256COLOURS) && - !(tty->term_flags & TERM_256COLOURS)) { + if (colours != 256) { gc->fg = colour_256to16(gc->fg); if (gc->fg & 8) { gc->fg &= 7; @@ -1674,7 +1678,12 @@ tty_check_bg(struct tty *tty, const struct window_pane *wp, } else return; } - colours = tty_term_number(tty->term, TTYC_COLORS); + + /* How many colours does this terminal have? */ + if ((tty->term->flags|tty->term_flags) & TERM_256COLOURS) + colours = 256; + else + colours = tty_term_number(tty->term, TTYC_COLORS); /* Is this a 256-colour colour? */ if (gc->bg & COLOUR_FLAG_256) { @@ -1683,8 +1692,7 @@ tty_check_bg(struct tty *tty, const struct window_pane *wp, * palette. Bold background doesn't exist portably, so just * discard the bold bit if set. */ - if (!(tty->term->flags & TERM_256COLOURS) && - !(tty->term_flags & TERM_256COLOURS)) { + if (colours != 256) { gc->bg = colour_256to16(gc->bg); if (gc->bg & 8) { gc->bg &= 7; |