From add20637f256c0118d3c687d5d1446612d14389a Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 14 Oct 2021 13:19:01 +0000 Subject: Add popup-border-lines option to set popup line style, from Alexis Hildebrandt, GitHub issue 2930. --- options.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index e32db774..65263fd0 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); -- cgit From 8d2286b76917debc4f6c3b0903ad2807ae254bb5 Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Nov 2021 09:34:49 +0000 Subject: Add a cursor-colour option, from Alexis Hildebrandt in GitHub issue 2959. --- options.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'options.c') diff --git a/options.c b/options.c index 65263fd0..4da1c408 100644 --- a/options.c +++ b/options.c @@ -1106,15 +1106,22 @@ options_push_changes(const char *name) struct session *s; struct window *w; struct window_pane *wp; + int c; 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) { + c = options_get_number(wp->options, name); + wp->screen->default_ccolour = c; + } + } if (strcmp(name, "key-table") == 0) { TAILQ_FOREACH(loop, &clients, entry) server_client_set_key_table(loop, NULL); -- cgit From 57100376cc70739f53a1f8a4bacf192b8cdcd124 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 3 Nov 2021 13:37:17 +0000 Subject: Add a cursor-style option, from Alexis Hildebrandt in GitHub issue 2960. --- options.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'options.c') diff --git a/options.c b/options.c index 4da1c408..865ab01f 100644 --- a/options.c +++ b/options.c @@ -1122,6 +1122,14 @@ options_push_changes(const char *name) wp->screen->default_ccolour = c; } } + if (strcmp(name, "cursor-style") == 0) { + RB_FOREACH(wp, window_pane_tree, &all_window_panes) { + wp->screen->default_mode = 0; + screen_set_cursor_style(options_get_number(wp->options, + name), &wp->screen->default_cstyle, + &wp->screen->default_mode); + } + } if (strcmp(name, "key-table") == 0) { TAILQ_FOREACH(loop, &clients, entry) server_client_set_key_table(loop, NULL); -- cgit From e6e737ac0bf9a5be729b5c71f3a582355432d041 Mon Sep 17 00:00:00 2001 From: nicm Date: Wed, 16 Mar 2022 17:00:17 +0000 Subject: Add an option to set the character used for unused areas of the terminal, GitHub issue 3110. --- options.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'options.c') diff --git a/options.c b/options.c index 865ab01f..f9cf2afd 100644 --- a/options.c +++ b/options.c @@ -1108,6 +1108,8 @@ options_push_changes(const char *name) struct window_pane *wp; int c; + log_debug("%s: %s", __func__, name); + if (strcmp(name, "automatic-rename") == 0) { RB_FOREACH(w, windows, &windows) { if (w->active == NULL) @@ -1130,6 +1132,10 @@ options_push_changes(const char *name) &wp->screen->default_mode); } } + 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); -- cgit From d9f84854ac01c8d4f6d5507e88d1dc7bcdd99558 Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 17 Jun 2022 07:28:05 +0000 Subject: Check cursor options when a pane is created, not just when they are changed. --- options.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'options.c') diff --git a/options.c b/options.c index f9cf2afd..fef5637e 100644 --- a/options.c +++ b/options.c @@ -1106,7 +1106,6 @@ options_push_changes(const char *name) struct session *s; struct window *w; struct window_pane *wp; - int c; log_debug("%s: %s", __func__, name); @@ -1119,18 +1118,12 @@ options_push_changes(const char *name) } } if (strcmp(name, "cursor-colour") == 0) { - RB_FOREACH(wp, window_pane_tree, &all_window_panes) { - c = options_get_number(wp->options, name); - wp->screen->default_ccolour = c; - } + 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) { - wp->screen->default_mode = 0; - screen_set_cursor_style(options_get_number(wp->options, - name), &wp->screen->default_cstyle, - &wp->screen->default_mode); - } + 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) -- cgit