diff options
-rw-r--r-- | cmd-send-keys.c | 2 | ||||
-rw-r--r-- | key-bindings.c | 17 | ||||
-rw-r--r-- | server-client.c | 2 | ||||
-rw-r--r-- | tmux.h | 4 |
4 files changed, 14 insertions, 11 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c index e54574fe..5c6db347 100644 --- a/cmd-send-keys.c +++ b/cmd-send-keys.c @@ -73,7 +73,7 @@ cmd_send_keys_inject(struct client *c, struct cmdq_item *item, key_code key) bd = RB_FIND(key_bindings, &table->key_bindings, &bd_find); if (bd != NULL) { table->references++; - key_bindings_dispatch(bd, c, NULL, &item->target); + key_bindings_dispatch(bd, item, c, NULL, &item->target); key_bindings_unref_table(table); } } diff --git a/key-bindings.c b/key-bindings.c index 9e327655..8f56cbee 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -400,11 +400,11 @@ 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 cmd_find_state *fs) +key_bindings_dispatch(struct key_binding *bd, struct cmdq_item *item, + struct client *c, struct mouse_event *m, struct cmd_find_state *fs) { struct cmd *cmd; - struct cmdq_item *item; + struct cmdq_item *new_item; int readonly; readonly = 1; @@ -413,11 +413,14 @@ key_bindings_dispatch(struct key_binding *bd, struct client *c, readonly = 0; } if (!readonly && (c->flags & CLIENT_READONLY)) - cmdq_append(c, cmdq_get_callback(key_bindings_read_only, NULL)); + new_item = cmdq_get_callback(key_bindings_read_only, NULL); else { - item = cmdq_get_command(bd->cmdlist, fs, m, 0); + new_item = cmdq_get_command(bd->cmdlist, fs, m, 0); if (bd->flags & KEY_BINDING_REPEAT) - item->shared->flags |= CMDQ_SHARED_REPEAT; - cmdq_append(c, item); + new_item->shared->flags |= CMDQ_SHARED_REPEAT; } + if (item != NULL) + cmdq_insert_after(item, new_item); + else + cmdq_append(c, new_item); } diff --git a/server-client.c b/server-client.c index e8a9f757..e5c21dfb 100644 --- a/server-client.c +++ b/server-client.c @@ -945,7 +945,7 @@ retry: server_status_client(c); /* Execute the key binding. */ - key_bindings_dispatch(bd, c, m, &fs); + key_bindings_dispatch(bd, NULL, c, m, &fs); key_bindings_unref_table(table); return; } @@ -1805,8 +1805,8 @@ void key_bindings_add(const char *, key_code, int, struct cmd_list *); 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 cmd_find_state *); +void key_bindings_dispatch(struct key_binding *, struct cmdq_item *, + struct client *, struct mouse_event *, struct cmd_find_state *); /* key-string.c */ key_code key_string_lookup_string(const char *); |