Set up -t flag properly when passing new-session -A off to

attach-session, GitHub issue 295.
This commit is contained in:
nicm 2016-02-04 14:11:20 +00:00
parent 97882f9ce2
commit bdb8bb790e

View File

@ -68,7 +68,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
{ {
struct args *args = self->args; struct args *args = self->args;
struct client *c = cmdq->client; struct client *c = cmdq->client;
struct session *s, *attach_sess; struct session *s, *as;
struct session *groupwith = cmdq->state.tflag.s; struct session *groupwith = cmdq->state.tflag.s;
struct window *w; struct window *w;
struct environ *env; struct environ *env;
@ -100,7 +100,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
cmdq_error(cmdq, "bad session name: %s", newname); cmdq_error(cmdq, "bad session name: %s", newname);
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
if ((attach_sess = session_find(newname)) != NULL) { if ((as = session_find(newname)) != NULL) {
if (args_has(args, 'A')) { if (args_has(args, 'A')) {
/* /*
* This cmdq is now destined for * This cmdq is now destined for
@ -108,7 +108,7 @@ cmd_new_session_exec(struct cmd *self, struct cmd_q *cmdq)
* will have already been prepared, copy this * will have already been prepared, copy this
* session into its tflag so it can be used. * session into its tflag so it can be used.
*/ */
cmdq->state.tflag.s = attach_sess; cmd_find_from_session(&cmdq->state.tflag, as);
return (cmd_attach_session(cmdq, return (cmd_attach_session(cmdq,
args_has(args, 'D'), 0, NULL, args_has(args, 'D'), 0, NULL,
args_has(args, 'E'))); args_has(args, 'E')));