summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authorTiago Cunha <tcunha@gmx.com>2011-10-23 15:05:20 +0000
committerTiago Cunha <tcunha@gmx.com>2011-10-23 15:05:20 +0000
commit7d169a3679b254c657823906fb61505bccc26aa3 (patch)
tree8c0643a47f7e91c5e08ef6f8b23673083a93e90f /cmd-new-session.c
parent98e500f5982a92f6ca1910193c1d6f5ac07ef52b (diff)
Sync OpenBSD patchset 967:
For initial session, use size of command client even if detached.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 7be71048..774df7db 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -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--;