summaryrefslogtreecommitdiffstats
path: root/cmd-select-pane.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-select-pane.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-select-pane.c')
-rw-r--r--cmd-select-pane.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd-select-pane.c b/cmd-select-pane.c
index 7fc5d6ee..700bacb2 100644
--- a/cmd-select-pane.c
+++ b/cmd-select-pane.c
@@ -56,6 +56,7 @@ static enum cmd_retval
cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct winlink *wl = item->state.tflag.wl;
struct window *w = wl->window;
struct session *s = item->state.tflag.s;
@@ -68,7 +69,6 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "no last pane");
return (CMD_RETURN_ERROR);
}
-
if (args_has(self->args, 'e'))
lastwp->flags &= ~PANE_INPUTOFF;
else if (args_has(self->args, 'd'))
@@ -77,6 +77,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
server_unzoom_window(w);
window_redraw_active_switch(w, lastwp);
if (window_set_active_pane(w, lastwp)) {
+ cmd_find_from_winlink(current, wl);
server_status_window(w);
server_redraw_window_borders(w);
}
@@ -155,6 +156,7 @@ cmd_select_pane_exec(struct cmd *self, struct cmdq_item *item)
}
window_redraw_active_switch(w, wp);
if (window_set_active_pane(w, wp)) {
+ cmd_find_from_winlink(current, wl);
server_status_window(w);
server_redraw_window_borders(w);
}