diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-06-16 08:18:35 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2020-06-16 08:18:35 +0000 |
commit | 2aa5d2dff59a78c07ce91553f49badcd410d1d9c (patch) | |
tree | 7e5081ed5fd6ab6418c7b21411e29f67defe4e93 /usr.bin/tmux/options.c | |
parent | 59c3d6f7d6fab2b9c155fc32c38e0a008a7cac29 (diff) |
d and D keys to reset to default in customize mode.
Diffstat (limited to 'usr.bin/tmux/options.c')
-rw-r--r-- | usr.bin/tmux/options.c | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/usr.bin/tmux/options.c b/usr.bin/tmux/options.c index a3d6b490588..273b3e8c795 100644 --- a/usr.bin/tmux/options.c +++ b/usr.bin/tmux/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.58 2020/05/16 16:35:13 nicm Exp $ */ +/* $OpenBSD: options.c,v 1.59 2020/06/16 08:18:34 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -66,6 +66,7 @@ struct options { }; static struct options_entry *options_add(struct options *, const char *); +static void options_remove(struct options_entry *); #define OPTIONS_IS_STRING(o) \ ((o)->tableentry == NULL || \ @@ -315,7 +316,7 @@ options_add(struct options *oo, const char *name) return (o); } -void +static void options_remove(struct options_entry *o) { struct options *oo = o->owner; @@ -1106,3 +1107,21 @@ options_push_changes(const char *name) server_redraw_client(loop); } } + +int +options_remove_or_default(struct options_entry *o, int idx, char **cause) +{ + struct options *oo = o->owner; + + if (idx == -1) { + if (o->tableentry != NULL && + (oo == global_options || + oo == global_s_options || + oo == global_w_options)) + options_default(oo, o->tableentry); + else + options_remove(o); + } else if (options_array_set(o, idx, NULL, 0, cause) != 0) + return (-1); + return (0); +} |