summaryrefslogtreecommitdiffstats
path: root/cmd-show-options.c
diff options
context:
space:
mode:
authornicm <nicm>2019-06-20 11:59:59 +0000
committernicm <nicm>2019-06-20 11:59:59 +0000
commit5f92f92908b81b4ec66682adb84b9ffc8d83c2f7 (patch)
tree1efeb76d391658d00d7b6028ae02b2cf49a5cac6 /cmd-show-options.c
parentc1ede507d954b98a73c40665e7aee6fe5f0c5bce (diff)
Add a per-pane option set. Pane options inherit from window options (so
there should be no change to existing behaviour) and are set and shown with set-option -p and show-options -p. Change remain-on-exit and window-style/window-active-style to be pane options (some others will be changed later). This makes select-pane -P and -g unnecessary so no longer document them (they still work) and no longer document set-window-option and show-window-options in favour of set-option -w and show-options -w.
Diffstat (limited to 'cmd-show-options.c')
-rw-r--r--cmd-show-options.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/cmd-show-options.c b/cmd-show-options.c
index 109c6c52..5b22b8bd 100644
--- a/cmd-show-options.c
+++ b/cmd-show-options.c
@@ -33,16 +33,16 @@ static enum cmd_retval cmd_show_options_exec(struct cmd *, struct cmdq_item *);
static void cmd_show_options_print(struct cmd *, struct cmdq_item *,
struct options_entry *, int, int);
static enum cmd_retval cmd_show_options_all(struct cmd *, struct cmdq_item *,
- enum options_table_scope, struct options *);
+ int, struct options *);
const struct cmd_entry cmd_show_options_entry = {
.name = "show-options",
.alias = "show",
- .args = { "AgHqst:vw", 0, 1 },
- .usage = "[-AgHqsvw] [-t target-session|target-window] [option]",
+ .args = { "AgHpqst:vw", 0, 1 },
+ .usage = "[-AgHpqsvw] " CMD_TARGET_PANE_USAGE " [option]",
- .target = { 't', CMD_FIND_WINDOW, CMD_FIND_CANFAIL },
+ .target = { 't', CMD_FIND_PANE, CMD_FIND_CANFAIL },
.flags = CMD_AFTERHOOK,
.exec = cmd_show_options_exec
@@ -83,9 +83,8 @@ cmd_show_options_exec(struct cmd *self, struct cmdq_item *item)
struct session *s = item->target.s;
struct winlink *wl = item->target.wl;
struct options *oo;
- enum options_table_scope scope;
char *argument, *name = NULL, *cause;
- int window, idx, ambiguous, parent;
+ int window, idx, ambiguous, parent, scope;
struct options_entry *o;
window = (self->entry == &cmd_show_window_options_entry);
@@ -191,17 +190,18 @@ cmd_show_options_print(struct cmd *self, struct cmdq_item *item,
}
static enum cmd_retval
-cmd_show_options_all(struct cmd *self, struct cmdq_item *item,
- enum options_table_scope scope, struct options *oo)
+cmd_show_options_all(struct cmd *self, struct cmdq_item *item, int scope,
+ struct options *oo)
{
const struct options_table_entry *oe;
struct options_entry *o;
struct options_array_item *a;
+ const char *name;
u_int idx;
int parent;
for (oe = options_table; oe->name != NULL; oe++) {
- if (oe->scope != scope)
+ if (~oe->scope & scope)
continue;
if ((self->entry != &cmd_show_hooks_entry &&
@@ -228,15 +228,17 @@ cmd_show_options_all(struct cmd *self, struct cmdq_item *item,
cmd_show_options_print(self, item, o, -1, parent);
else if ((a = options_array_first(o)) == NULL) {
if (!args_has(self->args, 'v')) {
+ name = options_name(o);
if (parent)
- cmdq_print(item, "%s*", options_name(o));
+ cmdq_print(item, "%s*", name);
else
- cmdq_print(item, "%s", options_name(o));
+ cmdq_print(item, "%s", name);
}
} else {
while (a != NULL) {
idx = options_array_item_index(a);
- cmd_show_options_print(self, item, o, idx, parent);
+ cmd_show_options_print(self, item, o, idx,
+ parent);
a = options_array_next(a);
}
}