aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2017-05-10 14:01:11 +0100
committerThomas Adam <thomas@xteddy.org>2017-05-10 14:01:11 +0100
commitf8b3f1622dcc250556599656e112a0068c75efab (patch)
tree2afc5fffaa93d551d061ba89aef1365aa730e204
parentdaef51e038132157b08f37e365dd845847243462 (diff)
parent0e3c5ebe1a229fbb8d829c9413ae013fb2eeb1ed (diff)
downloadrtmux-f8b3f1622dcc250556599656e112a0068c75efab.tar.gz
rtmux-f8b3f1622dcc250556599656e112a0068c75efab.tar.bz2
rtmux-f8b3f1622dcc250556599656e112a0068c75efab.zip
Merge branch 'obsd-master'
-rw-r--r--cmd-send-keys.c2
-rw-r--r--key-bindings.c17
-rw-r--r--server-client.c2
-rw-r--r--tmux.h4
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;
}
diff --git a/tmux.h b/tmux.h
index e8ad55ff..52ec692f 100644
--- a/tmux.h
+++ b/tmux.h
@@ -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 *);