diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2012-12-08 17:05:57 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2012-12-08 17:05:57 +0000 |
commit | 3fa4f691e32482b2d07d16be84b6e22657f9c7dd (patch) | |
tree | 4bb030e1304566d860f7bda5a27f7f351dcaeb8e /screen-write.c | |
parent | 8600fe054bd5db89f8e5758d657018f111be0610 (diff) |
Handle resetting 256-colours properly when parsing #[default],
#[fg=default] and #[bg=default] styles.
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/screen-write.c b/screen-write.c index ce9411b6..ec7d741e 100644 --- a/screen-write.c +++ b/screen-write.c @@ -324,6 +324,9 @@ screen_write_parsestyle( fg = defgc->fg; bg = defgc->bg; attr = defgc->attr; + flags &= ~(GRID_FLAG_FG256|GRID_FLAG_BG256); + flags |= + defgc->flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); } else if (end > 3 && strncasecmp(tmp + 1, "g=", 2) == 0) { if ((val = colour_fromstring(tmp + 3)) == -1) return; @@ -335,8 +338,11 @@ screen_write_parsestyle( } else flags &= ~GRID_FLAG_FG256; fg = val; - } else + } else { fg = defgc->fg; + flags &= ~GRID_FLAG_FG256; + flags |= defgc->flags & GRID_FLAG_FG256; + } } else if (*in == 'b' || *in == 'B') { if (val != 8) { if (val & 0x100) { @@ -345,8 +351,11 @@ screen_write_parsestyle( } else flags &= ~GRID_FLAG_BG256; bg = val; - } else + } else { bg = defgc->bg; + flags &= ~GRID_FLAG_BG256; + flags |= defgc->flags & GRID_FLAG_BG256; + } } else return; } else if (end > 2 && strncasecmp(tmp, "no", 2) == 0) { |