summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2011-10-23 08:10:12 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2011-10-23 08:10:12 +0000
commit496b6cc1a81073b990d5aab40895b939234183c4 (patch)
treeb59fef8e18a44bfea798c42b0f6e526125f39931
parent2ca20765e89b9b90135216a20543db37b370598f (diff)
For initial session, use size of command client even if detached.
-rw-r--r--usr.bin/tmux/cmd-new-session.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 9f1b20e196d..807680ce4f0 100644
--- a/usr.bin/tmux/cmd-new-session.c
+++ b/usr.bin/tmux/cmd-new-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-new-session.c,v 1.38 2011/04/06 21:51:31 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.39 2011/10/23 08:10:11 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -154,9 +154,17 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
}
/* Find new session size. */
- if (detached) {
+ if (ctx->cmdclient != NULL) {
+ sx = ctx->cmdclient->tty.sx;
+ sy = ctx->cmdclient->tty.sy;
+ } else if (ctx->curclient != NULL) {
+ sx = ctx->curclient->tty.sx;
+ sy = ctx->curclient->tty.sy;
+ } else {
sx = 80;
sy = 24;
+ }
+ if (detached) {
if (args_has(args, 'x')) {
sx = strtonum(
args_get(args, 'x'), 1, USHRT_MAX, &errstr);
@@ -173,12 +181,6 @@ cmd_new_session_exec(struct cmd *self, struct cmd_ctx *ctx)
return (-1);
}
}
- } else if (ctx->cmdclient != NULL) {
- sx = ctx->cmdclient->tty.sx;
- sy = ctx->cmdclient->tty.sy;
- } else {
- sx = ctx->curclient->tty.sx;
- sy = ctx->curclient->tty.sy;
}
if (sy > 0 && options_get_number(&global_s_options, "status"))
sy--;