summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-select-window.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-select-window.c')
-rw-r--r--usr.bin/tmux/cmd-select-window.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/usr.bin/tmux/cmd-select-window.c b/usr.bin/tmux/cmd-select-window.c
index 44b2f76bbb1..5d7d4296abe 100644
--- a/usr.bin/tmux/cmd-select-window.c
+++ b/usr.bin/tmux/cmd-select-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-select-window.c,v 1.18 2016/10/16 19:04:05 nicm Exp $ */
+/* $OpenBSD: cmd-select-window.c,v 1.19 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -84,9 +84,10 @@ const struct cmd_entry cmd_last_window_entry = {
static enum cmd_retval
cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
{
- struct winlink *wl = item->state.tflag.wl;
- struct session *s = item->state.tflag.s;
- int next, previous, last, activity;
+ struct cmd_find_state *current = &item->shared->current;
+ struct winlink *wl = item->state.tflag.wl;
+ struct session *s = item->state.tflag.s;
+ int next, previous, last, activity;
next = self->entry == &cmd_next_window_entry;
if (args_has(self->args, 'n'))
@@ -116,7 +117,7 @@ cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
return (CMD_RETURN_ERROR);
}
}
-
+ cmd_find_from_session(&item->shared->current, s);
server_redraw_session(s);
} else {
/*
@@ -128,9 +129,13 @@ cmd_select_window_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "no last window");
return (-1);
}
+ if (current->s == s)
+ cmd_find_from_session(current, s);
server_redraw_session(s);
- } else if (session_select(s, wl->idx) == 0)
+ } else if (session_select(s, wl->idx) == 0) {
+ cmd_find_from_session(current, s);
server_redraw_session(s);
+ }
}
recalculate_sizes();