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:
Nicholas Marriott
2020-04-28 13:50:07 +01:00
parent a43a156846
commit 1f8256fc50
14 changed files with 226 additions and 174 deletions

View File

@ -400,15 +400,19 @@ const struct options_table_entry options_table[] = {
},
{ .name = "message-command-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "bg=black,fg=yellow"
.default_str = "bg=black,fg=yellow",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "message-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "bg=yellow,fg=black"
.default_str = "bg=yellow,fg=black",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "mouse",
@ -472,13 +476,13 @@ const struct options_table_entry options_table[] = {
{ .name = "status-bg",
.type = OPTIONS_TABLE_COLOUR,
.scope = OPTIONS_TABLE_SESSION,
.default_num = 2,
.default_num = 8,
},
{ .name = "status-fg",
.type = OPTIONS_TABLE_COLOUR,
.scope = OPTIONS_TABLE_SESSION,
.default_num = 0,
.default_num = 8,
},
{ .name = "status-format",
@ -525,9 +529,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "status-left-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "status-position",
@ -554,15 +560,19 @@ const struct options_table_entry options_table[] = {
},
{ .name = "status-right-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "status-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "bg=green,fg=black"
.default_str = "bg=green,fg=black",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "update-environment",
@ -665,9 +675,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "mode-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "bg=yellow,fg=black"
.default_str = "bg=yellow,fg=black",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "monitor-activity",
@ -703,9 +715,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "pane-active-border-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "fg=green"
.default_str = "fg=green",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "pane-base-index",
@ -731,9 +745,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "pane-border-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "remain-on-exit",
@ -749,9 +765,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "window-active-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-size",
@ -762,21 +780,27 @@ const struct options_table_entry options_table[] = {
},
{ .name = "window-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW|OPTIONS_TABLE_PANE,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-status-activity-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "reverse"
.default_str = "reverse",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-status-bell-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "reverse"
.default_str = "reverse",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-status-current-format",
@ -786,9 +810,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "window-status-current-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-status-format",
@ -798,9 +824,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "window-status-last-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "window-status-separator",
@ -810,9 +838,11 @@ const struct options_table_entry options_table[] = {
},
{ .name = "window-status-style",
.type = OPTIONS_TABLE_STYLE,
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "default"
.default_str = "default",
.flags = OPTIONS_TABLE_IS_STYLE,
.separator = ","
},
{ .name = "wrap-search",