summaryrefslogtreecommitdiffstats
path: root/cmd-new-window.c
diff options
context:
space:
mode:
authornicm <nicm>2020-06-25 08:56:02 +0000
committernicm <nicm>2020-06-25 08:56:02 +0000
commitf69bdda950fde2218ed3fc189ceaa587a5374ab9 (patch)
treea3f9e0d3280b6c455c330316cd255fcd1d536a68 /cmd-new-window.c
parent5340bf556e460c52f02d4f23591eafd5131d95ed (diff)
Silently ignore -a or -b if the window index doesn't exist and create
using that index (this is how it used to work), reported by Romain Francoise.
Diffstat (limited to 'cmd-new-window.c')
-rw-r--r--cmd-new-window.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd-new-window.c b/cmd-new-window.c
index 0b24474b..ca3e66c4 100644
--- a/cmd-new-window.c
+++ b/cmd-new-window.c
@@ -68,10 +68,8 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
before = args_has(args, 'b');
if (args_has(args, 'a') || before) {
idx = winlink_shuffle_up(s, wl, before);
- if (idx == -1) {
- cmdq_error(item, "couldn't get a window index");
- return (CMD_RETURN_ERROR);
- }
+ if (idx == -1)
+ idx = target->idx;
}
memset(&sc, 0, sizeof sc);
@@ -114,7 +112,7 @@ cmd_new_window_exec(struct cmd *self, struct cmdq_item *item)
if ((template = args_get(args, 'F')) == NULL)
template = NEW_WINDOW_TEMPLATE;
cp = format_single(item, template, tc, s, new_wl,
- new_wl->window->active);
+ new_wl->window->active);
cmdq_print(item, "%s", cp);
free(cp);
}