Drop having a separate type for style options and make them all strings,

which allows formats to be expanded. Any styles without a '#{' are still
validated when they are set but any with a '#{' are not. Formats are not
expanded usefully in many cases yet, that will be changed later.

To make this work, a few other changes:

- set-option -a with a style option automatically appends a ",".

- OSC 10 and 11 don't set the window-style option anymore, instead the
  fg and bg are stored in the pane struct and act as the defaults that
  can be overridden by window-style.

- status-fg and -bg now override status-style instead of trying to keep
  them in sync.
This commit is contained in:
nicm
2020-05-16 15:01:30 +00:00
parent 0487029fc5
commit f03b61131b
18 changed files with 514 additions and 350 deletions

View File

@ -321,7 +321,7 @@ status_redraw(struct client *c)
struct screen_write_ctx ctx;
struct grid_cell gc;
u_int lines, i, n, width = c->tty.sx;
int flags, force = 0, changed = 0;
int flags, force = 0, changed = 0, fg, bg;
struct options_entry *o;
union options_value *ov;
struct format_tree *ft;
@ -339,7 +339,13 @@ status_redraw(struct client *c)
return (1);
/* Set up default colour. */
style_apply(&gc, s->options, "status-style");
style_apply(&gc, s->options, "status-style", NULL);
fg = options_get_number(s->options, "status-fg");
if (fg != 8)
gc.fg = fg;
bg = options_get_number(s->options, "status-bg");
if (bg != 8)
gc.bg = bg;
if (!grid_cells_equal(&gc, &sl->style)) {
force = 1;
memcpy(&sl->style, &gc, sizeof sl->style);
@ -490,7 +496,7 @@ status_message_redraw(struct client *c)
if (len > c->tty.sx)
len = c->tty.sx;
style_apply(&gc, s->options, "message-style");
style_apply(&gc, s->options, "message-style", NULL);
screen_write_start(&ctx, NULL, sl->active);
screen_write_fast_copy(&ctx, &sl->screen, 0, 0, c->tty.sx, lines - 1);
@ -633,9 +639,9 @@ status_prompt_redraw(struct client *c)
screen_init(sl->active, c->tty.sx, lines, 0);
if (c->prompt_mode == PROMPT_COMMAND)
style_apply(&gc, s->options, "message-command-style");
style_apply(&gc, s->options, "message-command-style", NULL);
else
style_apply(&gc, s->options, "message-style");
style_apply(&gc, s->options, "message-style", NULL);
memcpy(&cursorgc, &gc, sizeof cursorgc);
cursorgc.attr ^= GRID_ATTR_REVERSE;