summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/server-client.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/server-client.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/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 12fb0c8cf56..d16b15a01a1 100644
--- a/usr.bin/tmux/server-client.c
+++ b/usr.bin/tmux/server-client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-client.c,v 1.226 2017/04/21 22:23:24 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.227 2017/04/22 08:56:24 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -856,10 +856,9 @@ server_client_handle_key(struct client *c, key_code key)
m->valid = 0;
/* Find affected pane. */
- if (KEYC_IS_MOUSE(key) && m->valid)
- wp = cmd_mouse_pane(m, NULL, NULL);
- else
- wp = w->active;
+ if (!KEYC_IS_MOUSE(key) || cmd_find_from_mouse(&fs, m) != 0)
+ cmd_find_from_session(&fs, s);
+ wp = fs.wp;
/* Forward mouse keys if disabled. */
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
@@ -946,13 +945,8 @@ retry:
}
server_status_client(c);
- /* Find default state if the pane is known. */
- if (KEYC_IS_MOUSE(key) && m->valid && wp != NULL) {
- cmd_find_from_winlink_pane(&fs, s->curw, wp);
- cmd_find_log_state(__func__, &fs);
- key_bindings_dispatch(bd, c, m, &fs);
- } else
- key_bindings_dispatch(bd, c, m, NULL);
+ /* Execute the key binding. */
+ key_bindings_dispatch(bd, c, m, &fs);
key_bindings_unref_table(table);
return;
}