From c6049a4914a501d83cb431b03c6336a50cded0ea Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sat, 22 Apr 2017 08:56:25 +0000 Subject: 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. --- usr.bin/tmux/cmd-find-window.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.bin/tmux/cmd-find-window.c') 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 @@ -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; } -- cgit v1.2.3