From 0114d4f8c3da572a689ac99bdc5f4d03ad631e6a Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 1 Jun 2019 16:21:38 +0000 Subject: If only one of -x or -y is given, use the calculated size for the other. Pointed out by Ben Boeckel. --- usr.bin/tmux/cmd-new-session.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'usr.bin/tmux') diff --git a/usr.bin/tmux/cmd-new-session.c b/usr.bin/tmux/cmd-new-session.c index eee2e8f5d56..b2ab646f9ea 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.118 2019/05/17 05:47:31 nicm Exp $ */ +/* $OpenBSD: cmd-new-session.c,v 1.119 2019/06/01 16:21:37 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -242,8 +242,13 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item) /* Create the new session. */ oo = options_create(global_s_options); - if (args_has(args, 'x') || args_has(args, 'y')) + if (args_has(args, 'x') || args_has(args, 'y')) { + if (!args_has(args, 'x')) + dsx = sx; + if (!args_has(args, 'y')) + dsy = sy; options_set_string(oo, "default-size", 0, "%ux%u", dsx, dsy); + } env = environ_create(); if (c != NULL && !args_has(args, 'E')) environ_update(global_s_options, c->environ, env); -- cgit v1.2.3