summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-attach-session.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2017-04-22 08:56:24 +0000
committernicm <nicm@openbsd.org>2017-04-22 08:56:24 +0000
commit0e2c9d0f0effc1d2ee144f302bcdacd2fbafa082 (patch)
tree389cb0062e095c32de617b06be251304a93eeee5 /usr.bin/tmux/cmd-attach-session.c
parentWe need to collect UTF-8 characters so that width != 1 characters are (diff)
downloadwireguard-openbsd-0e2c9d0f0effc1d2ee144f302bcdacd2fbafa082.tar.xz
wireguard-openbsd-0e2c9d0f0effc1d2ee144f302bcdacd2fbafa082.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 'usr.bin/tmux/cmd-attach-session.c')
-rw-r--r--usr.bin/tmux/cmd-attach-session.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index d9af1a2cd15..0ba69f49c65 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.71 2017/04/21 14:01:19 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.72 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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) {