diff options
author | 2018-06-08 09:41:34 +0000 | |
---|---|---|
committer | 2018-06-08 09:41:34 +0000 | |
commit | e2d5d61cce22f8e5af6b840bfe27ef3a34baa974 (patch) | |
tree | 38e1e084962e5806663d3d6cf5b4d287cb4eda51 | |
parent | Handle AENs for logical disk creation and deletion. (diff) | |
download | wireguard-openbsd-e2d5d61cce22f8e5af6b840bfe27ef3a34baa974.tar.xz wireguard-openbsd-e2d5d61cce22f8e5af6b840bfe27ef3a34baa974.zip |
Add -x- and -y- to use client size, from Stefan Assmann in GitHub issue 1372.
-rw-r--r-- | usr.bin/tmux/cmd-new-session.c | 28 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.1 | 7 |
2 files changed, 23 insertions, 12 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) diff --git a/usr.bin/tmux/tmux.1 b/usr.bin/tmux/tmux.1 index f5d944c90a9..8035329b8f5 100644 --- a/usr.bin/tmux/tmux.1 +++ b/usr.bin/tmux/tmux.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: tmux.1,v 1.600 2018/06/03 10:17:30 nicm Exp $ +.\" $OpenBSD: tmux.1,v 1.601 2018/06/08 09:41:34 nicm Exp $ .\" .\" Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> .\" @@ -14,7 +14,7 @@ .\" IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 3 2018 $ +.Dd $Mdocdate: June 8 2018 $ .Dt TMUX 1 .Os .Sh NAME @@ -850,7 +850,8 @@ the initial size is 80 x 24; .Fl x and .Fl y -can be used to specify a different size. +can be used to specify a different size, with the special case "-" which uses +the size of the current terminal. .Pp If run from a terminal, any .Xr termios 4 |