diff options
author | nicm <nicm> | 2017-04-22 08:56:24 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-04-22 08:56:24 +0000 |
commit | 2c0f826c360fc5a8f0e125759b596eb28441ba65 (patch) | |
tree | 67909c9035b3986a6edd9421553be544b90513aa /cmd-attach-session.c | |
parent | bcab77e266c37e2f1cbb74006e9b927ea4f99dfb (diff) | |
download | rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.tar.gz rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.tar.bz2 rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.zip |
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-attach-session.c')
-rw-r--r-- | cmd-attach-session.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd-attach-session.c b/cmd-attach-session.c index 684fc3f1..22d9320d 100644 --- a/cmd-attach-session.c +++ b/cmd-attach-session.c @@ -50,6 +50,7 @@ enum cmd_retval cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, const char *cflag, int Eflag) { + struct cmd_find_state *current = &item->shared->current; struct session *s = item->state.tflag.s; struct client *c = item->client, *c_loop; struct winlink *wl = item->state.tflag.wl; @@ -73,6 +74,10 @@ cmd_attach_session(struct cmdq_item *item, int dflag, int rflag, if (wp != NULL) window_set_active_pane(wp->window, wp); session_set_current(s, wl); + if (wp != NULL) + cmd_find_from_winlink_pane(current, wl, wp); + else + cmd_find_from_winlink(current, wl); } if (cflag != NULL) { |