summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-new-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-06-27 02:57:00 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-06-27 02:57:00 +0000
commitb109c783d06f4af76ff573fa020fbe9d1d855f7b (patch)
treefb5b8ce39c74b686b7bd375bc614be54f75bd473 /usr.bin/tmux/cmd-new-window.c
parent30a46c2d76c094d24f6e4d5323c296dfd6b865dd (diff)
Store the current working directory in the session, change the default-path
option to default to empty and make that mean that the stored session CWD is used.
Diffstat (limited to 'usr.bin/tmux/cmd-new-window.c')
-rw-r--r--usr.bin/tmux/cmd-new-window.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/usr.bin/tmux/cmd-new-window.c b/usr.bin/tmux/cmd-new-window.c
index c1728b2e84e..bf17196cbda 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.14 2010/06/21 01:27:46 nicm Exp $ */
+/* $OpenBSD: cmd-new-window.c,v 1.15 2010/06/27 02:56:59 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -176,10 +176,13 @@ cmd_new_window_exec(struct cmd *self, struct cmd_ctx *ctx)
cmd = data->cmd;
if (cmd == NULL)
cmd = options_get_string(&s->options, "default-command");
- if (ctx->cmdclient == NULL || ctx->cmdclient->cwd == NULL)
- cwd = options_get_string(&s->options, "default-path");
- else
- cwd = ctx->cmdclient->cwd;
+ cwd = options_get_string(&s->options, "default-path");
+ if (*cwd == '\0') {
+ if (ctx->cmdclient != NULL && ctx->cmdclient->cwd != NULL)
+ cwd = ctx->cmdclient->cwd;
+ else
+ cwd = s->cwd;
+ }
if (idx == -1)
idx = -1 - options_get_number(&s->options, "base-index");