diff options
author | 2014-02-22 01:38:47 +0000 | |
---|---|---|
committer | 2014-02-22 01:38:47 +0000 | |
commit | 477264232d20d25f684bbc23da133cd4cee75e9f (patch) | |
tree | dfbd9279a04e873ec18170a68540a5acee5dbf6f | |
parent | when processing Match blocks, skip 'exec' clauses if previous predicates (diff) | |
download | wireguard-openbsd-477264232d20d25f684bbc23da133cd4cee75e9f.tar.xz wireguard-openbsd-477264232d20d25f684bbc23da133cd4cee75e9f.zip |
Fix -fg/-bg/-style with 256 colour terminals.
-rw-r--r-- | usr.bin/tmux/style.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/usr.bin/tmux/style.c b/usr.bin/tmux/style.c index 748951a4dad..2529ee0ce9a 100644 --- a/usr.bin/tmux/style.c +++ b/usr.bin/tmux/style.c @@ -1,4 +1,4 @@ -/* $OpenBSD: style.c,v 1.1 2014/01/28 23:07:09 nicm Exp $ */ +/* $OpenBSD: style.c,v 1.2 2014/02/22 01:38:47 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -203,8 +203,14 @@ style_apply(struct grid_cell *gc, struct options *oo, const char *name) memcpy(gc, &grid_default_cell, sizeof *gc); gcp = options_get_style(oo, name); - colour_set_fg(gc, gcp->fg); - colour_set_bg(gc, gcp->bg); + if (gcp->flags & GRID_FLAG_FG256) + colour_set_fg(gc, gcp->fg | 0x100); + else + colour_set_fg(gc, gcp->fg); + if (gcp->flags & GRID_FLAG_BG256) + colour_set_bg(gc, gcp->bg | 0x100); + else + colour_set_bg(gc, gcp->bg); gc->attr |= gcp->attr; } @@ -215,10 +221,18 @@ style_apply_update(struct grid_cell *gc, struct options *oo, const char *name) struct grid_cell *gcp; gcp = options_get_style(oo, name); - if (gcp->fg != 8) - colour_set_fg(gc, gcp->fg); - if (gcp->bg != 8) - colour_set_bg(gc, gcp->bg); + if (gcp->fg != 8) { + if (gcp->flags & GRID_FLAG_FG256) + colour_set_fg(gc, gcp->fg | 0x100); + else + colour_set_fg(gc, gcp->fg); + } + if (gcp->bg != 8) { + if (gcp->flags & GRID_FLAG_BG256) + colour_set_bg(gc, gcp->bg | 0x100); + else + colour_set_bg(gc, gcp->bg); + } if (gcp->attr != 0) gc->attr |= gcp->attr; } |