summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authornicm <nicm>2021-11-11 09:31:16 +0000
committernicm <nicm>2021-11-11 09:31:16 +0000
commitcb8a0d83fbaa2ae49c06105cb94d247ef20ed91e (patch)
treedd390ea4a9c1fd3f81356b94a2258cd055582e1e /input.c
parent630c592ef8740a935ba6c12c957a359c94414219 (diff)
If automatic-rename is off, allow the escape sequence to set an empty
window name, GitHub issue 2964.
Diffstat (limited to 'input.c')
-rw-r--r--input.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/input.c b/input.c
index 3626c4b2..73a58890 100644
--- a/input.c
+++ b/input.c
@@ -2382,6 +2382,7 @@ static void
input_exit_rename(struct input_ctx *ictx)
{
struct window_pane *wp = ictx->wp;
+ struct window *w;
struct options_entry *o;
if (wp == NULL)
@@ -2394,17 +2395,20 @@ input_exit_rename(struct input_ctx *ictx)
if (!utf8_isvalid(ictx->input_buf))
return;
+ w = wp->window;
if (ictx->input_len == 0) {
- o = options_get_only(wp->window->options, "automatic-rename");
+ o = options_get_only(w->options, "automatic-rename");
if (o != NULL)
options_remove_or_default(o, -1, NULL);
- return;
+ if (!options_get_number(w->options, "automatic-rename"))
+ window_set_name(w, "");
+ } else {
+ options_set_number(w->options, "automatic-rename", 0);
+ window_set_name(w, ictx->input_buf);
}
- window_set_name(wp->window, ictx->input_buf);
- options_set_number(wp->window->options, "automatic-rename", 0);
- server_redraw_window_borders(wp->window);
- server_status_window(wp->window);
+ server_redraw_window_borders(w);
+ server_status_window(w);
}
/* Open UTF-8 character. */