summaryrefslogtreecommitdiffstats
path: root/cmd-send-keys.c
diff options
context:
space:
mode:
authornicm <nicm>2015-12-12 18:19:00 +0000
committernicm <nicm>2015-12-12 18:19:00 +0000
commit39cf9c9d31954198ad73e2b6721a92fe782ee56c (patch)
tree8b2a0238d0d1ccf01232a2f45560dd5b0c9259fe /cmd-send-keys.c
parent88bc8f3528b973adb17f541e21aa415923a10f1e (diff)
Allow prefix and prefix2 to be set to None to disable (useful if you
would rather bind the prefix in the root table).
Diffstat (limited to 'cmd-send-keys.c')
-rw-r--r--cmd-send-keys.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/cmd-send-keys.c b/cmd-send-keys.c
index 73a308ae..1461baa9 100644
--- a/cmd-send-keys.c
+++ b/cmd-send-keys.c
@@ -52,8 +52,8 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
struct mouse_event *m = &cmdq->item->mouse;
struct window_pane *wp;
struct session *s;
- const u_char *str;
- int i;
+ int i, literal;
+ const u_char *keystr;
key_code key;
if (args_has(args, 'M')) {
@@ -82,14 +82,17 @@ cmd_send_keys_exec(struct cmd *self, struct cmd_q *cmdq)
input_reset(wp);
for (i = 0; i < args->argc; i++) {
- str = args->argv[i];
-
- if (!args_has(args, 'l') &&
- (key = key_string_lookup_string(str)) != KEYC_NONE) {
- window_pane_key(wp, NULL, s, key, NULL);
- } else {
- for (; *str != '\0'; str++)
- window_pane_key(wp, NULL, s, *str, NULL);
+ literal = args_has(args, 'l');
+ if (!literal) {
+ key = key_string_lookup_string(args->argv[i]);
+ if (key != KEYC_NONE && key != KEYC_UNKNOWN)
+ window_pane_key(wp, NULL, s, key, NULL);
+ else
+ literal = 1;
+ }
+ if (literal) {
+ for (keystr = args->argv[i]; *keystr != '\0'; keystr++)
+ window_pane_key(wp, NULL, s, *keystr, NULL);
}
}