summaryrefslogtreecommitdiffstats
path: root/key-bindings.c
diff options
context:
space:
mode:
authornicm <nicm>2017-05-10 10:46:59 +0000
committernicm <nicm>2017-05-10 10:46:59 +0000
commit0e3c5ebe1a229fbb8d829c9413ae013fb2eeb1ed (patch)
tree3e9cc730a24f7318dff4bd26a543dcd6993b3421 /key-bindings.c
parent3712b41abaff3dcf676d2b3da916fde7b456eb42 (diff)
Insert copy mode bindings at the right place in the command queue.
Diffstat (limited to 'key-bindings.c')
-rw-r--r--key-bindings.c17
1 files changed, 10 insertions, 7 deletions
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);
}