diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2009-09-10 17:16:24 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2009-09-10 17:16:24 +0000 |
commit | 372a8cb1d9c4306f74b592660b4ce394dff3e31d (patch) | |
tree | f1f14875c69932859e6d65365a4742a6ee095652 /screen-write.c | |
parent | 3f3b01c7ce503d98ab649fa4aecde741ce63cec0 (diff) | |
download | rtmux-372a8cb1d9c4306f74b592660b4ce394dff3e31d.tar.gz rtmux-372a8cb1d9c4306f74b592660b4ce394dff3e31d.tar.bz2 rtmux-372a8cb1d9c4306f74b592660b4ce394dff3e31d.zip |
Permit options such as status-bg to be configured using the entire 256 colour
palette by setting "colour0" to "colour255".
Diffstat (limited to 'screen-write.c')
-rw-r--r-- | screen-write.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/screen-write.c b/screen-write.c index 62acadd2..dba5f708 100644 --- a/screen-write.c +++ b/screen-write.c @@ -300,7 +300,7 @@ screen_write_parsestyle( char tmp[32]; int val; size_t end; - u_char fg, bg, attr; + u_char fg, bg, attr, flags; if (*in == '\0') return; @@ -309,7 +309,8 @@ screen_write_parsestyle( fg = gc->fg; bg = gc->bg; - attr = 0; + attr = gc->attr; + flags = gc->flags; do { end = strcspn(in, delimiters); if (end > (sizeof tmp) - 1) @@ -325,14 +326,24 @@ screen_write_parsestyle( if ((val = colour_fromstring(tmp + 3)) == -1) return; if (*in == 'f' || *in == 'F') { - if (val != 8) + if (val != 8) { + if (val & 0x100) { + flags |= GRID_FLAG_FG256; + val &= ~0x100; + } else + flags &= ~GRID_FLAG_FG256; fg = val; - else + } else fg = defgc->fg; } else if (*in == 'b' || *in == 'B') { - if (val != 8) + if (val != 8) { + if (val & 0x100) { + flags |= GRID_FLAG_BG256; + val &= ~0x100; + } else + flags &= ~GRID_FLAG_BG256; bg = val; - else + } else bg = defgc->bg; } else return; @@ -347,6 +358,7 @@ screen_write_parsestyle( gc->fg = fg; gc->bg = bg; gc->attr = attr; + gc->flags = flags; } /* Copy from another screen. */ @@ -1002,7 +1014,8 @@ screen_write_cell( if (screen_check_selection(s, s->cx - width, s->cy)) { memcpy(&tmp_gc2, &s->sel.cell, sizeof tmp_gc2); tmp_gc2.data = gc->data; - tmp_gc2.flags = gc->flags; + tmp_gc2.flags = gc->flags & ~(GRID_FLAG_FG256|GRID_FLAG_BG256); + tmp_gc2.flags |= s->sel.cell.flags & (GRID_FLAG_FG256|GRID_FLAG_BG256); ttyctx.cell = &tmp_gc2; tty_write(tty_cmd_cell, &ttyctx); } else { |