summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-06-03 07:15:24 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-06-03 07:15:24 +0000
commit776d2b3b65ce881f926ef5c0d74aaef367c8f473 (patch)
tree2d3c135ca12d21ba7c2c1cd7ef3e787009f4d6cf /usr.bin/tmux/tty.c
parent0ce6232d8a70af8147147483f99e57e11a90f2d0 (diff)
Foreground colours with the bright attribute set need to use the bright
entries in the palette. GitHub issue 954.
Diffstat (limited to 'usr.bin/tmux/tty.c')
-rw-r--r--usr.bin/tmux/tty.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/usr.bin/tmux/tty.c b/usr.bin/tmux/tty.c
index c6836f2d075..8075f19c284 100644
--- a/usr.bin/tmux/tty.c
+++ b/usr.bin/tmux/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.287 2017/05/31 10:29:15 nicm Exp $ */
+/* $OpenBSD: tty.c,v 1.288 2017/06/03 07:15:23 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1841,10 +1841,18 @@ tty_check_fg(struct tty *tty, const struct window_pane *wp,
u_int colours;
int c;
- /* Perform substitution if this pane has a palette */
- if ((~gc->flags & GRID_FLAG_NOPALETTE) &&
- (c = window_pane_get_palette(wp, gc->fg)) != -1)
- gc->fg = c;
+ /*
+ * Perform substitution if this pane has a palette. If the bright
+ * attribute is set, use the bright entry in the palette by changing to
+ * the aixterm colour.
+ */
+ if (~gc->flags & GRID_FLAG_NOPALETTE) {
+ c = gc->fg;
+ if (gc->fg < 8 && gc->attr & GRID_ATTR_BRIGHT)
+ c += 90;
+ if ((c = window_pane_get_palette(wp, c)) != -1)
+ gc->fg = c;
+ }
/* Is this a 24-bit colour? */
if (gc->fg & COLOUR_FLAG_RGB) {
@@ -1894,10 +1902,11 @@ tty_check_bg(struct tty *tty, const struct window_pane *wp,
u_int colours;
int c;
- /* Perform substitution if this pane has a palette */
- if ((~gc->flags & GRID_FLAG_NOPALETTE) &&
- (c = window_pane_get_palette(wp, gc->bg)) != -1)
- gc->bg = c;
+ /* Perform substitution if this pane has a palette. */
+ if (~gc->flags & GRID_FLAG_NOPALETTE) {
+ if ((c = window_pane_get_palette(wp, gc->bg)) != -1)
+ gc->bg = c;
+ }
/* Is this a 24-bit colour? */
if (gc->bg & COLOUR_FLAG_RGB) {