summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-new-session.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2018-06-08 09:41:35 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2018-06-08 09:41:35 +0000
commit92a47d2dc51e73db18bb1017e83d51df55e9653b (patch)
treed1ad00b64ff69aefdd9f103b790971faa3025270 /usr.bin/tmux/cmd-new-session.c
parentb0a2b306b335e19fdbfb7fbb4d6b1db7a136c283 (diff)
Add -x- and -y- to use client size, from Stefan Assmann in GitHub issue 1372.
Diffstat (limited to 'usr.bin/tmux/cmd-new-session.c')
-rw-r--r--usr.bin/tmux/cmd-new-session.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c
index 039943c1727..510b956ded7 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.111 2018/05/24 09:42:49 nicm Exp $ */
+/* $OpenBSD: cmd-new-session.c,v 1.112 2018/06/08 09:41:34 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -202,17 +202,27 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
sy = 24;
}
if ((is_control || detached) && args_has(args, 'x')) {
- sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr);
- if (errstr != NULL) {
- cmdq_error(item, "width %s", errstr);
- goto error;
+ tmp = args_get(args, 'x');
+ if (strcmp(tmp, "-") == 0)
+ sx = c->tty.sx;
+ else {
+ sx = strtonum(tmp, 1, USHRT_MAX, &errstr);
+ if (errstr != NULL) {
+ cmdq_error(item, "width %s", errstr);
+ goto error;
+ }
}
}
if ((is_control || detached) && args_has(args, 'y')) {
- sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr);
- if (errstr != NULL) {
- cmdq_error(item, "height %s", errstr);
- goto error;
+ tmp = args_get(args, 'y');
+ if (strcmp(tmp, "-") == 0)
+ sy = c->tty.sy;
+ else {
+ sy = strtonum(tmp, 1, USHRT_MAX, &errstr);
+ if (errstr != NULL) {
+ cmdq_error(item, "height %s", errstr);
+ goto error;
+ }
}
}
if (sx == 0)