mirror of
https://github.com/tmux/tmux.git
synced 2025-01-27 16:48:49 +00:00
Fix new-session with -t after command flags changes, reported by Michael Graczyk.
This commit is contained in:
parent
427b820426
commit
225a384dbb
@ -74,7 +74,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
struct environ *env;
|
struct environ *env;
|
||||||
struct termios tio, *tiop;
|
struct termios tio, *tiop;
|
||||||
const char *newname, *target, *update, *errstr, *template;
|
const char *newname, *target, *update, *errstr, *template;
|
||||||
const char *path, *cwd, *to_free;
|
const char *path, *cwd, *to_free = NULL;
|
||||||
char **argv, *cmd, *cause, *cp;
|
char **argv, *cmd, *cause, *cp;
|
||||||
int detached, already_attached, idx, argc;
|
int detached, already_attached, idx, argc;
|
||||||
u_int sx, sy;
|
u_int sx, sy;
|
||||||
@ -118,7 +118,12 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((target = args_get(args, 't')) == NULL)
|
if ((target = args_get(args, 't')) != NULL) {
|
||||||
|
if (groupwith == NULL) {
|
||||||
|
cmdq_error(cmdq, "no such session: %s", target);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
} else
|
||||||
groupwith = NULL;
|
groupwith = NULL;
|
||||||
|
|
||||||
/* Set -d if no client. */
|
/* Set -d if no client. */
|
||||||
@ -132,7 +137,6 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
already_attached = 1;
|
already_attached = 1;
|
||||||
|
|
||||||
/* Get the new session working directory. */
|
/* Get the new session working directory. */
|
||||||
to_free = NULL;
|
|
||||||
if (args_has(args, 'c')) {
|
if (args_has(args, 'c')) {
|
||||||
ft = format_create(cmdq, 0);
|
ft = format_create(cmdq, 0);
|
||||||
format_defaults(ft, c, NULL, NULL, NULL);
|
format_defaults(ft, c, NULL, NULL, NULL);
|
||||||
@ -208,7 +212,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
if (!args_has(args, 't') && args->argc != 0) {
|
if (!args_has(args, 't') && args->argc != 0) {
|
||||||
argc = args->argc;
|
argc = args->argc;
|
||||||
argv = args->argv;
|
argv = args->argv;
|
||||||
} else if (target == NULL) {
|
} else if (groupwith == NULL) {
|
||||||
cmd = options_get_string(global_s_options, "default-command");
|
cmd = options_get_string(global_s_options, "default-command");
|
||||||
if (cmd != NULL && *cmd != '\0') {
|
if (cmd != NULL && *cmd != '\0') {
|
||||||
argc = 1;
|
argc = 1;
|
||||||
@ -257,7 +261,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
|
|||||||
* If a target session is given, this is to be part of a session group,
|
* If a target session is given, this is to be part of a session group,
|
||||||
* so add it to the group and synchronize.
|
* so add it to the group and synchronize.
|
||||||
*/
|
*/
|
||||||
if (args_has(args, 't')) {
|
if (groupwith != NULL) {
|
||||||
session_group_add(groupwith, s);
|
session_group_add(groupwith, s);
|
||||||
session_group_synchronize_to(s);
|
session_group_synchronize_to(s);
|
||||||
session_select(s, RB_MIN(winlinks, &s->windows)->idx);
|
session_select(s, RB_MIN(winlinks, &s->windows)->idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user