aboutsummaryrefslogtreecommitdiff
path: root/options.c
diff options
context:
space:
mode:
authorJosh Rahm <rahm@google.com>2022-07-21 15:53:59 -0600
committerJosh Rahm <rahm@google.com>2022-07-21 15:53:59 -0600
commitb11548e3db4361cd8312ffbd27472823bdab4d62 (patch)
treea84b5cf79fb41bb60b6495c1a346bb360b224604 /options.c
parent88ebf5544e995d85b2f1416a216ac7f44f719eed (diff)
parentab1d18d00febe161080b8e81331861481110809f (diff)
downloadrtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.tar.gz
rtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.tar.bz2
rtmux-b11548e3db4361cd8312ffbd27472823bdab4d62.zip
Merge remote-tracking branch 'origin/master' into rahm
Diffstat (limited to 'options.c')
-rw-r--r--options.c49
1 files changed, 37 insertions, 12 deletions
diff --git a/options.c b/options.c
index e32db774..fef5637e 100644
--- a/options.c
+++ b/options.c
@@ -989,28 +989,39 @@ options_from_string_flag(struct options *oo, const char *name,
return (0);
}
+int
+options_find_choice(const struct options_table_entry *oe, const char *value,
+ char **cause)
+{
+ const char **cp;
+ int n = 0, choice = -1;
+
+ for (cp = oe->choices; *cp != NULL; cp++) {
+ if (strcmp(*cp, value) == 0)
+ choice = n;
+ n++;
+ }
+ if (choice == -1) {
+ xasprintf(cause, "unknown value: %s", value);
+ return (-1);
+ }
+ return (choice);
+}
+
static int
options_from_string_choice(const struct options_table_entry *oe,
struct options *oo, const char *name, const char *value, char **cause)
{
- const char **cp;
- int n, choice = -1;
+ int choice = -1;
if (value == NULL) {
choice = options_get_number(oo, name);
if (choice < 2)
choice = !choice;
} else {
- n = 0;
- for (cp = oe->choices; *cp != NULL; cp++) {
- if (strcmp(*cp, value) == 0)
- choice = n;
- n++;
- }
- if (choice == -1) {
- xasprintf(cause, "unknown value: %s", value);
+ choice = options_find_choice(oe, value, cause);
+ if (choice < 0)
return (-1);
- }
}
options_set_number(oo, name, choice);
return (0);
@@ -1096,14 +1107,28 @@ options_push_changes(const char *name)
struct window *w;
struct window_pane *wp;
+ log_debug("%s: %s", __func__, name);
+
if (strcmp(name, "automatic-rename") == 0) {
RB_FOREACH(w, windows, &windows) {
if (w->active == NULL)
continue;
- if (options_get_number(w->options, "automatic-rename"))
+ if (options_get_number(w->options, name))
w->active->flags |= PANE_CHANGED;
}
}
+ if (strcmp(name, "cursor-colour") == 0) {
+ RB_FOREACH(wp, window_pane_tree, &all_window_panes)
+ window_pane_default_cursor(wp);
+ }
+ if (strcmp(name, "cursor-style") == 0) {
+ RB_FOREACH(wp, window_pane_tree, &all_window_panes)
+ window_pane_default_cursor(wp);
+ }
+ if (strcmp(name, "fill-character") == 0) {
+ RB_FOREACH(w, windows, &windows)
+ window_set_fill_character(w);
+ }
if (strcmp(name, "key-table") == 0) {
TAILQ_FOREACH(loop, &clients, entry)
server_client_set_key_table(loop, NULL);