summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-10-14 09:19:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-10-14 09:19:41 +0000
commitbeb92891e07b9a83304051a10a7835c0b0941682 (patch)
tree9a701da262bbcac17776b535f3dccc893ca69e25 /usr.bin
parent7d7c44515461674f0b2fc50edf3e5715f32bfbbd (diff)
Turn automatic-rename back on if the rename escape sequence is used with
an empty name, GitHub issue 1921.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/input.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c
index 55253750b41..e5b5ab9da5f 100644
--- a/usr.bin/tmux/input.c
+++ b/usr.bin/tmux/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.161 2019/09/25 19:05:59 nicm Exp $ */
+/* $OpenBSD: input.c,v 1.162 2019/10/14 09:19:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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);