summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-find-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2017-04-22 08:56:25 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2017-04-22 08:56:25 +0000
commitc6049a4914a501d83cb431b03c6336a50cded0ea (patch)
tree2c149daaa19c4c9a46e4eca94829bd1f38949557 /usr.bin/tmux/cmd-find-window.c
parente237049fb8cc194c517234892690b5dd0dd8c2e9 (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 'usr.bin/tmux/cmd-find-window.c')
-rw-r--r--usr.bin/tmux/cmd-find-window.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.bin/tmux/cmd-find-window.c b/usr.bin/tmux/cmd-find-window.c
index 8be8d6a43df..0ece6fd8dc3 100644
--- a/usr.bin/tmux/cmd-find-window.c
+++ b/usr.bin/tmux/cmd-find-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-find-window.c,v 1.39 2016/10/16 19:04:05 nicm Exp $ */
+/* $OpenBSD: cmd-find-window.c,v 1.40 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -142,6 +142,7 @@ static enum cmd_retval
cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
{
struct args *args = self->args;
+ struct cmd_find_state *current = &item->shared->current;
struct client *c = item->state.c;
struct window_choose_data *cdata;
struct session *s = item->state.tflag.s;
@@ -177,8 +178,10 @@ cmd_find_window_exec(struct cmd *self, struct cmdq_item *item)
}
if (TAILQ_NEXT(TAILQ_FIRST(&find_list), entry) == NULL) {
- if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0)
+ if (session_select(s, TAILQ_FIRST(&find_list)->wl->idx) == 0) {
+ cmd_find_from_session(current, s);
server_redraw_session(s);
+ }
recalculate_sizes();
goto out;
}