summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm>2019-03-18 21:46:01 +0000
committernicm <nicm>2019-03-18 21:46:01 +0000
commitf34ebfed7698ce41fe7bae756c0bb0c485e8bfdb (patch)
tree4616d578f2334bf5a0cb2cc0ab4bc00e902da674
parentc62404673e873c7fae7151a6e910f1b9354b7ecf (diff)
The individual -fg, -bg and -attr options have been deprecated (in
favour of -style), undocumented and hidden from show-options since 2014. Remove them, except for status-fg and status-bg.
-rw-r--r--cmd-set-option.c23
-rw-r--r--cmd-show-options.c4
-rw-r--r--options-table.c247
-rw-r--r--options.c45
-rw-r--r--tmux.h6
5 files changed, 12 insertions, 313 deletions
diff --git a/cmd-set-option.c b/cmd-set-option.c
index ddbfc334..96428d73 100644
--- a/cmd-set-option.c
+++ b/cmd-set-option.c
@@ -81,6 +81,7 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
char *name, *argument, *value = NULL, *cause;
const char *target;
int window, idx, already, error, ambiguous;
+ struct style *sy;
/* Expand argument. */
c = cmd_find_client(item, NULL, 1);
@@ -247,6 +248,16 @@ cmd_set_option_exec(struct cmd *self, struct cmdq_item *item)
tty_keys_build(&loop->tty);
}
}
+ if (strcmp(name, "status-fg") == 0 || strcmp(name, "status-bg") == 0) {
+ sy = options_get_style(oo, "status-style");
+ sy->gc.fg = options_get_number(oo, "status-fg");
+ sy->gc.bg = options_get_number(oo, "status-bg");
+ }
+ if (strcmp(name, "status-style") == 0) {
+ sy = options_get_style(oo, "status-style");
+ options_set_number(oo, "status-fg", sy->gc.fg);
+ options_set_number(oo, "status-bg", sy->gc.bg);
+ }
if (strcmp(name, "status") == 0 ||
strcmp(name, "status-interval") == 0)
status_timer_start_all();
@@ -342,16 +353,7 @@ cmd_set_option_set(struct cmd *self, struct cmdq_item *item, struct options *oo,
cmdq_error(item, "bad colour: %s", value);
return (-1);
}
- o = options_set_number(oo, oe->name, number);
- options_style_update_new(oo, o);
- return (0);
- case OPTIONS_TABLE_ATTRIBUTES:
- if ((number = attributes_fromstring(value)) == -1) {
- cmdq_error(item, "bad attributes: %s", value);
- return (-1);
- }
- o = options_set_number(oo, oe->name, number);
- options_style_update_new(oo, o);
+ options_set_number(oo, oe->name, number);
return (0);
case OPTIONS_TABLE_FLAG:
return (cmd_set_option_flag(item, oe, oo, value));
@@ -363,7 +365,6 @@ cmd_set_option_set(struct cmd *self, struct cmdq_item *item, struct options *oo,
cmdq_error(item, "bad style: %s", value);
return (-1);
}
- options_style_update_old(oo, o);
return (0);
case OPTIONS_TABLE_ARRAY:
break;
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 872f0c45..79827e32 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -173,10 +173,6 @@ cmd_show_options_all(struct cmd *self, struct cmdq_item *item,
o = options_first(oo);
while (o != NULL) {
oe = options_table_entry(o);
- if (oe != NULL && oe->style != NULL) {
- o = options_next(o);
- continue;
- }
if (!options_isarray(o))
cmd_show_options_print(self, item, o, -1);
else {
diff --git a/options-table.c b/options-table.c
index a2a3ffe6..d4a64b38 100644
--- a/options-table.c
+++ b/options-table.c
@@ -315,54 +315,12 @@ const struct options_table_entry options_table[] = {
.default_str = "lock -np"
},
- { .name = "message-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "message-style"
- },
-
- { .name = "message-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 3,
- .style = "message-style"
- },
-
- { .name = "message-command-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "message-command-style"
- },
-
- { .name = "message-command-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "message-command-style"
- },
-
- { .name = "message-command-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 3,
- .style = "message-command-style"
- },
-
{ .name = "message-command-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_SESSION,
.default_str = "bg=black,fg=yellow"
},
- { .name = "message-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "message-style"
- },
-
{ .name = "message-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_SESSION,
@@ -427,25 +385,16 @@ const struct options_table_entry options_table[] = {
.default_num = 1
},
- { .name = "status-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "status-style"
- },
-
{ .name = "status-bg",
.type = OPTIONS_TABLE_COLOUR,
.scope = OPTIONS_TABLE_SESSION,
.default_num = 2,
- .style = "status-style"
},
{ .name = "status-fg",
.type = OPTIONS_TABLE_COLOUR,
.scope = OPTIONS_TABLE_SESSION,
.default_num = 0,
- .style = "status-style"
},
{ .name = "status-format",
@@ -482,27 +431,6 @@ const struct options_table_entry options_table[] = {
.default_str = "[#S] "
},
- { .name = "status-left-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "status-left-style"
- },
-
- { .name = "status-left-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 8,
- .style = "status-left-style"
- },
-
- { .name = "status-left-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 8,
- .style = "status-left-style"
- },
-
{ .name = "status-left-length",
.type = OPTIONS_TABLE_NUMBER,
.scope = OPTIONS_TABLE_SESSION,
@@ -532,27 +460,6 @@ const struct options_table_entry options_table[] = {
"\"#{=21:pane_title}\" %H:%M %d-%b-%y"
},
- { .name = "status-right-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 0,
- .style = "status-right-style"
- },
-
- { .name = "status-right-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 8,
- .style = "status-right-style"
- },
-
- { .name = "status-right-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_SESSION,
- .default_num = 8,
- .style = "status-right-style"
- },
-
{ .name = "status-right-length",
.type = OPTIONS_TABLE_NUMBER,
.scope = OPTIONS_TABLE_SESSION,
@@ -667,27 +574,6 @@ const struct options_table_entry options_table[] = {
.default_num = 80
},
- { .name = "mode-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 0,
- .style = "mode-style"
- },
-
- { .name = "mode-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 3,
- .style = "mode-style"
- },
-
- { .name = "mode-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 0,
- .style = "mode-style"
- },
-
{ .name = "mode-keys",
.type = OPTIONS_TABLE_CHOICE,
.scope = OPTIONS_TABLE_WINDOW,
@@ -737,20 +623,6 @@ const struct options_table_entry options_table[] = {
.default_num = 0
},
- { .name = "pane-active-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "pane-active-border-style"
- },
-
- { .name = "pane-active-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 2,
- .style = "pane-active-border-style"
- },
-
{ .name = "pane-active-border-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_WINDOW,
@@ -765,20 +637,6 @@ const struct options_table_entry options_table[] = {
.default_num = 0
},
- { .name = "pane-border-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
- { .name = "pane-border-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "pane-border-style"
- },
-
{ .name = "pane-border-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
@@ -830,95 +688,18 @@ const struct options_table_entry options_table[] = {
.default_str = "default"
},
- { .name = "window-status-activity-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = GRID_ATTR_REVERSE,
- .style = "window-status-activity-style"
- },
-
- { .name = "window-status-activity-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-activity-style"
- },
-
- { .name = "window-status-activity-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-activity-style"
- },
-
{ .name = "window-status-activity-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "reverse"
},
- { .name = "window-status-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 0,
- .style = "window-status-style"
- },
-
- { .name = "window-status-bell-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = GRID_ATTR_REVERSE,
- .style = "window-status-bell-style"
- },
-
- { .name = "window-status-bell-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-bell-style"
- },
-
- { .name = "window-status-bell-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-bell-style"
- },
-
{ .name = "window-status-bell-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "reverse"
},
- { .name = "window-status-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-style"
- },
-
- { .name = "window-status-current-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 0,
- .style = "window-status-current-style"
- },
-
- { .name = "window-status-current-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-current-style"
- },
-
- { .name = "window-status-current-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-current-style"
- },
-
{ .name = "window-status-current-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
@@ -931,40 +712,12 @@ const struct options_table_entry options_table[] = {
.default_str = "default"
},
- { .name = "window-status-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-style"
- },
-
{ .name = "window-status-format",
.type = OPTIONS_TABLE_STRING,
.scope = OPTIONS_TABLE_WINDOW,
.default_str = "#I:#W#{?window_flags,#{window_flags}, }"
},
- { .name = "window-status-last-attr",
- .type = OPTIONS_TABLE_ATTRIBUTES,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 0,
- .style = "window-status-last-style"
- },
-
- { .name = "window-status-last-bg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-last-style"
- },
-
- { .name = "window-status-last-fg",
- .type = OPTIONS_TABLE_COLOUR,
- .scope = OPTIONS_TABLE_WINDOW,
- .default_num = 8,
- .style = "window-status-last-style"
- },
-
{ .name = "window-status-last-style",
.type = OPTIONS_TABLE_STYLE,
.scope = OPTIONS_TABLE_WINDOW,
diff --git a/options.c b/options.c
index 6a7c37d6..369776e3 100644
--- a/options.c
+++ b/options.c
@@ -78,7 +78,6 @@ static struct options_entry *options_add(struct options *, const char *);
((o)->tableentry->type == OPTIONS_TABLE_NUMBER || \
(o)->tableentry->type == OPTIONS_TABLE_KEY || \
(o)->tableentry->type == OPTIONS_TABLE_COLOUR || \
- (o)->tableentry->type == OPTIONS_TABLE_ATTRIBUTES || \
(o)->tableentry->type == OPTIONS_TABLE_FLAG || \
(o)->tableentry->type == OPTIONS_TABLE_CHOICE))
#define OPTIONS_IS_STYLE(o) \
@@ -416,9 +415,6 @@ options_tostring(struct options_entry *o, int idx, int numeric)
case OPTIONS_TABLE_COLOUR:
tmp = colour_tostring(o->number);
break;
- case OPTIONS_TABLE_ATTRIBUTES:
- tmp = attributes_tostring(o->number);
- break;
case OPTIONS_TABLE_FLAG:
if (numeric)
xsnprintf(s, sizeof s, "%lld", o->number);
@@ -708,44 +704,3 @@ options_scope_from_flags(struct args *args, int window,
return (OPTIONS_TABLE_SESSION);
}
}
-
-void
-options_style_update_new(struct options *oo, struct options_entry *o)
-{
- const char *newname = o->tableentry->style;
- struct options_entry *new;
-
- if (newname == NULL)
- return;
- new = options_get_only(oo, newname);
- if (new == NULL)
- new = options_set_style(oo, newname, 0, "default");
-
- if (strstr(o->name, "-bg") != NULL)
- new->style.gc.bg = o->number;
- else if (strstr(o->name, "-fg") != NULL)
- new->style.gc.fg = o->number;
- else if (strstr(o->name, "-attr") != NULL)
- new->style.gc.attr = o->number;
-}
-
-void
-options_style_update_old(struct options *oo, struct options_entry *o)
-{
- char newname[128];
- int size;
-
- size = strrchr(o->name, '-') - o->name;
-
- xsnprintf(newname, sizeof newname, "%.*s-bg", size, o->name);
- if (options_get(oo, newname) != NULL)
- options_set_number(oo, newname, o->style.gc.bg);
-
- xsnprintf(newname, sizeof newname, "%.*s-fg", size, o->name);
- if (options_get(oo, newname) != NULL)
- options_set_number(oo, newname, o->style.gc.fg);
-
- xsnprintf(newname, sizeof newname, "%.*s-attr", size, o->name);
- if (options_get(oo, newname) != NULL)
- options_set_number(oo, newname, o->style.gc.attr);
-}
diff --git a/tmux.h b/tmux.h
index e6ed430b..21947657 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1518,7 +1518,6 @@ enum options_table_type {
OPTIONS_TABLE_NUMBER,
OPTIONS_TABLE_KEY,
OPTIONS_TABLE_COLOUR,
- OPTIONS_TABLE_ATTRIBUTES,
OPTIONS_TABLE_FLAG,
OPTIONS_TABLE_CHOICE,
OPTIONS_TABLE_STYLE,
@@ -1546,7 +1545,6 @@ struct options_table_entry {
const char **default_arr;
const char *separator;
- const char *style;
const char *pattern;
};
@@ -1723,10 +1721,6 @@ struct options_entry *options_set_style(struct options *, const char *, int,
const char *);
enum options_table_scope options_scope_from_flags(struct args *, int,
struct cmd_find_state *, struct options **, char **);
-void options_style_update_new(struct options *,
- struct options_entry *);
-void options_style_update_old(struct options *,
- struct options_entry *);
/* options-table.c */
extern const struct options_table_entry options_table[];