summaryrefslogtreecommitdiffstats
path: root/tty.c
diff options
context:
space:
mode:
authornicm <nicm>2017-01-12 00:19:32 +0000
committernicm <nicm>2017-01-12 00:19:32 +0000
commit9e786030df1e68428fb2fdfa00a26c367ebb475c (patch)
tree5cf30e0215d2bc9193b099b945b6296af4193911 /tty.c
parent74c40d04eadc40c034634d70925355a0751c1433 (diff)
Fix setting the palette of aixterm colours (90-97).
Diffstat (limited to 'tty.c')
-rw-r--r--tty.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/tty.c b/tty.c
index d1a72599..dcf5e181 100644
--- a/tty.c
+++ b/tty.c
@@ -1609,11 +1609,12 @@ tty_check_fg(struct tty *tty, const struct window_pane *wp,
{
u_char r, g, b;
u_int colours;
+ int c;
/* Perform substitution if this pane has a palette */
if ((~gc->flags & GRID_FLAG_NOPALETTE) &&
- gc->fg != 8 && WINDOW_PANE_PALETTE_HAS(wp, gc->fg))
- gc->fg = wp->palette[gc->fg & 0xff];
+ (c = window_pane_get_palette(wp, gc->fg)) != -1)
+ gc->fg = c;
/* Is this a 24-bit colour? */
if (gc->fg & COLOUR_FLAG_RGB) {
@@ -1657,11 +1658,12 @@ tty_check_bg(struct tty *tty, const struct window_pane *wp,
{
u_char r, g, b;
u_int colours;
+ int c;
/* Perform substitution if this pane has a palette */
if ((~gc->flags & GRID_FLAG_NOPALETTE) &&
- gc->bg != 8 && WINDOW_PANE_PALETTE_HAS(wp, gc->bg))
- gc->bg = wp->palette[gc->bg & 0xff];
+ (c = window_pane_get_palette(wp, gc->bg)) != -1)
+ gc->bg = c;
/* Is this a 24-bit colour? */
if (gc->bg & COLOUR_FLAG_RGB) {
@@ -1817,6 +1819,7 @@ tty_default_colours(struct grid_cell *gc, const struct window_pane *wp)
struct window *w = wp->window;
struct options *oo = w->options;
const struct grid_cell *agc, *pgc, *wgc;
+ int c;
if (w->flags & WINDOW_STYLECHANGED) {
w->flags &= ~WINDOW_STYLECHANGED;
@@ -1838,8 +1841,9 @@ tty_default_colours(struct grid_cell *gc, const struct window_pane *wp)
else
gc->fg = wgc->fg;
- if (gc->fg != 8 && WINDOW_PANE_PALETTE_HAS(wp, gc->fg))
- gc->fg = wp->palette[gc->fg & 0xff];
+ if (gc->fg != 8 &&
+ (c = window_pane_get_palette(wp, gc->fg)) != -1)
+ gc->fg = c;
}
if (gc->bg == 8) {
@@ -1850,8 +1854,9 @@ tty_default_colours(struct grid_cell *gc, const struct window_pane *wp)
else
gc->bg = wgc->bg;
- if (gc->bg != 8 && WINDOW_PANE_PALETTE_HAS(wp, gc->bg))
- gc->bg = wp->palette[gc->bg & 0xff];
+ if (gc->bg != 8 &&
+ (c = window_pane_get_palette(wp, gc->bg)) != -1)
+ gc->bg = c;
}
}