summaryrefslogtreecommitdiffstats
path: root/input.c
diff options
context:
space:
mode:
authornicm <nicm>2019-10-14 09:19:40 +0000
committernicm <nicm>2019-10-14 09:19:40 +0000
commitf18cd5b19c3c8e3941c714f9d7e51914fb5d81f0 (patch)
tree5f8d32a34637f181654af8aba58ab16ff3999e52 /input.c
parentbbe8ebf9c26e45fd8c402627b84b3646db445d45 (diff)
Turn automatic-rename back on if the rename escape sequence is used with
an empty name, GitHub issue 1921.
Diffstat (limited to 'input.c')
-rw-r--r--input.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/input.c b/input.c
index d76216f4..fc08f42c 100644
--- a/input.c
+++ b/input.c
@@ -2279,6 +2279,9 @@ input_enter_rename(struct input_ctx *ictx)
static void
input_exit_rename(struct input_ctx *ictx)
{
+ struct window_pane *wp = ictx->wp;
+ struct options_entry *oe;
+
if (ictx->flags & INPUT_DISCARD)
return;
if (!options_get_number(ictx->wp->options, "allow-rename"))
@@ -2287,6 +2290,13 @@ input_exit_rename(struct input_ctx *ictx)
if (!utf8_isvalid(ictx->input_buf))
return;
+
+ if (ictx->input_len == 0) {
+ oe = options_get(wp->window->options, "automatic-rename");
+ if (oe != NULL)
+ options_remove(oe);
+ return;
+ }
window_set_name(ictx->wp->window, ictx->input_buf);
options_set_number(ictx->wp->window->options, "automatic-rename", 0);
server_status_window(ictx->wp->window);