If only one of -x or -y is given, use the calculated size for the

other. Also fix some warnings. Pointed out by Ben Boeckel.
pull/1782/head
Nicholas Marriott 2019-06-05 06:44:08 +01:00
parent 17bc11bd15
commit e252984993
4 changed files with 9 additions and 5 deletions

View File

@ -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);

View File

@ -23,6 +23,7 @@
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>

View File

@ -202,7 +202,7 @@ cmdq_get_command(struct cmd_list *cmdlist, struct cmd_find_state *current,
{
struct cmdq_item *item, *first = NULL, *last = NULL;
struct cmd *cmd;
struct cmdq_shared *shared;
struct cmdq_shared *shared = NULL;
u_int group = 0;
TAILQ_FOREACH(cmd, &cmdlist->list, qentry) {

View File

@ -1518,7 +1518,7 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
char **buf, size_t *len, size_t *off)
{
struct window_pane *wp = ft->wp;
const char *errptr, *copy, *cp, *marker;
const char *errptr, *copy, *cp, *marker = NULL;
char *copy0, *condition, *found, *new;
char *value, *left, *right;
size_t valuelen;
@ -1566,8 +1566,6 @@ format_replace(struct format_tree *ft, const char *key, size_t keylen,
limit = 0;
if (fm->argc == 2 && fm->argv[1] != NULL)
marker = fm->argv[1];
else
marker = NULL;
break;
case 'l':
modifiers |= FORMAT_LITERAL;