diff options
author | nicm <nicm> | 2017-04-22 08:56:24 +0000 |
---|---|---|
committer | nicm <nicm> | 2017-04-22 08:56:24 +0000 |
commit | 2c0f826c360fc5a8f0e125759b596eb28441ba65 (patch) | |
tree | 67909c9035b3986a6edd9421553be544b90513aa /server-client.c | |
parent | bcab77e266c37e2f1cbb74006e9b927ea4f99dfb (diff) | |
download | rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.tar.gz rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.tar.bz2 rtmux-2c0f826c360fc5a8f0e125759b596eb28441ba65.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 'server-client.c')
-rw-r--r-- | server-client.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/server-client.c b/server-client.c index 875f7ef7..f64e93bd 100644 --- a/server-client.c +++ b/server-client.c @@ -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; } |