From: nicm Date: Sat, 3 Jun 2017 07:15:23 +0000 (+0000) Subject: Foreground colours with the bright attribute set need to use the bright X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=d2ac4da76d96fb79310b7c8c8e0e9126d8c631ec;p=openbsd Foreground colours with the bright attribute set need to use the bright entries in the palette. GitHub issue 954. --- 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 @@ -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) {