mirror of
https://github.com/tmux/tmux.git
synced 2025-03-27 08:28:49 +00:00
Add a way to set individual defaults for an array option.
This commit is contained in:
parent
1d306e926a
commit
e8b33af780
13
options.c
13
options.c
@ -169,12 +169,17 @@ options_empty(struct options *oo, const struct options_table_entry *oe)
|
|||||||
struct options_entry *
|
struct options_entry *
|
||||||
options_default(struct options *oo, const struct options_table_entry *oe)
|
options_default(struct options *oo, const struct options_table_entry *oe)
|
||||||
{
|
{
|
||||||
struct options_entry *o;
|
struct options_entry *o;
|
||||||
|
u_int i;
|
||||||
|
|
||||||
o = options_empty(oo, oe);
|
o = options_empty(oo, oe);
|
||||||
if (oe->type == OPTIONS_TABLE_ARRAY)
|
if (oe->type == OPTIONS_TABLE_ARRAY) {
|
||||||
options_array_assign(o, oe->default_str);
|
if (oe->default_arr != NULL) {
|
||||||
else if (oe->type == OPTIONS_TABLE_STRING)
|
for (i = 0; oe->default_arr[i] != NULL; i++)
|
||||||
|
options_array_set(o, i, oe->default_arr[i], 0);
|
||||||
|
} else
|
||||||
|
options_array_assign(o, oe->default_str);
|
||||||
|
} else if (oe->type == OPTIONS_TABLE_STRING)
|
||||||
o->string = xstrdup(oe->default_str);
|
o->string = xstrdup(oe->default_str);
|
||||||
else if (oe->type == OPTIONS_TABLE_STYLE) {
|
else if (oe->type == OPTIONS_TABLE_STYLE) {
|
||||||
style_set(&o->style, &grid_default_cell);
|
style_set(&o->style, &grid_default_cell);
|
||||||
|
Loading…
Reference in New Issue
Block a user