summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2013-11-23 09:18:30 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2013-11-23 09:18:30 +0000
commit5ab0f8f40e7084047b69153606f375730b2b8a0e (patch)
treee6f3fe2e1e9c61499c16364b6511328966e161b4 /usr.bin
parent7c4548a0cd84a9d1aa4ee43de9ae9f07dd1f5af3 (diff)
With -k, kill window after using it to work out -c path. Reported by
jmacristovao at gmail dot com.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cmd-new-window.c42
1 files changed, 21 insertions, 21 deletions
diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c
index b93d0403b14..4851540d552 100644
--- a/usr.bin/tmux/cmd-new-window.c
+++ b/usr.bin/tmux/cmd-new-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-window.c,v 1.37 2013/11/22 20:58:36 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.38 2013/11/23 09:18:29 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -82,26 +82,6 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
}
detached = args_has(args, 'd');
- wl = NULL;
- if (idx != -1)
- wl = winlink_find_by_index(&s->windows, idx);
- if (wl != NULL && args_has(args, 'k')) {
- /*
- * Can't use session_detach as it will destroy session if this
- * makes it empty.
- */
- notify_window_unlinked(s, wl->window);
- wl->flags &= ~WINLINK_ALERTFLAGS;
- winlink_stack_remove(&s->lastw, wl);
- winlink_remove(&s->windows, wl);
-
- /* Force select/redraw if current. */
- if (wl == s->curw) {
- detached = 0;
- s->curw = NULL;
- }
- }
-
if (args->argc == 0)
cmd = options_get_string(&s->options, "default-command");
else
@@ -133,6 +113,26 @@ cmd_new_window_exec(struct cmd *self, struct cmd_q *cmdq)
else
cwd = s->cwd;
+ wl = NULL;
+ if (idx != -1)
+ wl = winlink_find_by_index(&s->windows, idx);
+ if (wl != NULL && args_has(args, 'k')) {
+ /*
+ * Can't use session_detach as it will destroy session if this
+ * makes it empty.
+ */
+ notify_window_unlinked(s, wl->window);
+ wl->flags &= ~WINLINK_ALERTFLAGS;
+ winlink_stack_remove(&s->lastw, wl);
+ winlink_remove(&s->windows, wl);
+
+ /* Force select/redraw if current. */
+ if (wl == s->curw) {
+ detached = 0;
+ s->curw = NULL;
+ }
+ }
+
if (idx == -1)
idx = -1 - options_get_number(&s->options, "base-index");
wl = session_new(s, args_get(args, 'n'), cmd, cwd, idx, &cause);