diff options
-rw-r--r-- | usr.bin/tmux/key-bindings.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 18 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 4 |
3 files changed, 21 insertions, 7 deletions
diff --git a/usr.bin/tmux/key-bindings.c b/usr.bin/tmux/key-bindings.c index 8d8a4a67ba7..56816fc4393 100644 --- a/usr.bin/tmux/key-bindings.c +++ b/usr.bin/tmux/key-bindings.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-bindings.c,v 1.64 2016/10/21 13:51:59 nicm Exp $ */ +/* $OpenBSD: key-bindings.c,v 1.65 2016/11/23 17:01:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -396,7 +396,7 @@ key_bindings_read_only(struct cmdq_item *item, __unused void *data) void key_bindings_dispatch(struct key_binding *bd, struct client *c, - struct mouse_event *m) + struct mouse_event *m, struct cmd_find_state *fs) { struct cmd *cmd; int readonly; @@ -409,5 +409,5 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c, if (!readonly && (c->flags & CLIENT_READONLY)) cmdq_append(c, cmdq_get_callback(key_bindings_read_only, NULL)); else - cmdq_append(c, cmdq_get_command(bd->cmdlist, NULL, m, 0)); + cmdq_append(c, cmdq_get_command(bd->cmdlist, fs, m, 0)); } diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 81ba5012992..f2be6e1ffba 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.200 2016/11/16 11:37:16 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.201 2016/11/23 17:01:24 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -692,6 +692,7 @@ server_client_handle_key(struct client *c, key_code key) struct key_table *table; struct key_binding bd_find, *bd; int xtimeout; + struct cmd_find_state fs; /* Check the client is good to accept input. */ if (s == NULL || (c->flags & (CLIENT_DEAD|CLIENT_SUSPENDED)) != 0) @@ -804,8 +805,21 @@ retry: } server_status_client(c); + /* Find default state if the pane is known. */ + cmd_find_clear_state(&fs, NULL, 0); + if (wp != NULL) { + fs.s = s; + fs.wl = fs.s->curw; + fs.w = fs.wl->window; + fs.wp = wp; + cmd_find_log_state(__func__, &fs); + + if (!cmd_find_valid_state(&fs)) + fatalx("invalid key state"); + } + /* Dispatch the key binding. */ - key_bindings_dispatch(bd, c, m); + key_bindings_dispatch(bd, c, m, &fs); key_bindings_unref_table(table); return; } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index bbb1f2758bf..0aaa89dbc73 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.678 2016/11/16 00:24:03 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.679 2016/11/23 17:01:24 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -1835,7 +1835,7 @@ void key_bindings_remove(const char *, key_code); void key_bindings_remove_table(const char *); void key_bindings_init(void); void key_bindings_dispatch(struct key_binding *, struct client *, - struct mouse_event *); + struct mouse_event *, struct cmd_find_state *); /* key-string.c */ key_code key_string_lookup_string(const char *); |