summaryrefslogtreecommitdiffstats
path: root/cmd-new-session.c
diff options
context:
space:
mode:
authornicm <nicm>2017-04-22 08:56:24 +0000
committernicm <nicm>2017-04-22 08:56:24 +0000
commit2c0f826c360fc5a8f0e125759b596eb28441ba65 (patch)
tree67909c9035b3986a6edd9421553be544b90513aa /cmd-new-session.c
parentbcab77e266c37e2f1cbb74006e9b927ea4f99dfb (diff)
Mouse bindings and hooks set up an initial current state when running a
command. This is used for the session, window and pane for all commands in the command sequence if there is no -t or -s. However, using it for all commands in the command sequence means that if the active pane or current session is changed, subsequent commands still use the previous state. So make commands which explicitly change the current state (such as neww and selectp) update it themselves for later commands. Commands which may invalidate the state (like killp) are already OK because an invalid state will be ignored. Also fill in the current state for all key bindings rather than just the mouse, so that any omissions are easier to spot.
Diffstat (limited to 'cmd-new-session.c')
-rw-r--r--cmd-new-session.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd-new-session.c b/cmd-new-session.c
index 0808b60c..cf0528d3 100644
--- a/cmd-new-session.c
+++ b/cmd-new-session.c
@@ -324,8 +324,10 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
free(cp);
}
- if (!detached)
+ if (!detached) {
c->flags |= CLIENT_ATTACHED;
+ cmd_find_from_session(&item->shared->current, s);
+ }
if (to_free != NULL)
free((void *)to_free);