mirror of
https://github.com/tmux/tmux.git
synced 2024-12-04 19:58:48 +00:00
Merge branch 'obsd-master'
This commit is contained in:
commit
073d439965
@ -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;
|
||||
|
@ -172,10 +172,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 {
|
||||
|
@ -694,8 +694,10 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
|
||||
}
|
||||
free(fr);
|
||||
|
||||
for (i = 0; i < TOTAL; i++)
|
||||
for (i = 0; i < TOTAL; i++) {
|
||||
screen_write_stop(&ctx[i]);
|
||||
log_debug("%s: width %s is %u", __func__, names[i], width[i]);
|
||||
}
|
||||
if (focus_start != -1 && focus_end != -1)
|
||||
log_debug("focus is %d-%d", focus_start, focus_end);
|
||||
TAILQ_FOREACH(fr, &frs, entry) {
|
||||
@ -748,6 +750,10 @@ format_draw(struct screen_write_ctx *octx, const struct grid_cell *base,
|
||||
format_free_range(&frs, fr);
|
||||
}
|
||||
|
||||
/* Free the screens. */
|
||||
for (i = 0; i < TOTAL; i++)
|
||||
screen_free(&s[i]);
|
||||
|
||||
/* Restore the original cursor position. */
|
||||
screen_write_cursormove(octx, ocx, ocy, 0);
|
||||
}
|
||||
|
247
options-table.c
247
options-table.c
@ -314,54 +314,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,
|
||||
@ -426,25 +384,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",
|
||||
@ -481,27 +430,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,
|
||||
@ -531,27 +459,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,
|
||||
@ -666,27 +573,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,
|
||||
@ -736,20 +622,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,
|
||||
@ -764,20 +636,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,
|
||||
@ -829,95 +687,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,
|
||||
@ -930,40 +711,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,
|
||||
|
45
options.c
45
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);
|
||||
}
|
||||
|
6
tmux.h
6
tmux.h
@ -1520,7 +1520,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,
|
||||
@ -1548,7 +1547,6 @@ struct options_table_entry {
|
||||
const char **default_arr;
|
||||
|
||||
const char *separator;
|
||||
const char *style;
|
||||
const char *pattern;
|
||||
};
|
||||
|
||||
@ -1725,10 +1723,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[];
|
||||
|
Loading…
Reference in New Issue
Block a user