diff options
author | Thomas Adam <thomas@xteddy.org> | 2016-11-23 18:01:19 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2016-11-23 18:01:19 +0000 |
commit | 8a8001350db320f6c8adfef161f96d0abb67e2b4 (patch) | |
tree | 315159db7eb6665c32d0bed155222ae627c80b44 | |
parent | 442e49f51c07a1fc508c6889d77065b8b4894893 (diff) | |
parent | 6de466cf8b665d8725301307c57f6d8cb2e65a3f (diff) | |
download | rtmux-8a8001350db320f6c8adfef161f96d0abb67e2b4.tar.gz rtmux-8a8001350db320f6c8adfef161f96d0abb67e2b4.tar.bz2 rtmux-8a8001350db320f6c8adfef161f96d0abb67e2b4.zip |
Merge branch 'obsd-master'
-rw-r--r-- | key-bindings.c | 4 | ||||
-rw-r--r-- | key-string.c | 5 | ||||
-rw-r--r-- | server-client.c | 16 | ||||
-rw-r--r-- | tmux.h | 2 |
4 files changed, 22 insertions, 5 deletions
diff --git a/key-bindings.c b/key-bindings.c index d07c7b49..9bc61b62 100644 --- a/key-bindings.c +++ b/key-bindings.c @@ -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/key-string.c b/key-string.c index d513ec6f..9ee1c2d2 100644 --- a/key-string.c +++ b/key-string.c @@ -140,6 +140,9 @@ key_string_get_modifiers(const char **string) case 's': modifiers |= KEYC_SHIFT; break; + default: + *string = NULL; + return 0; } *string += 2; } @@ -179,7 +182,7 @@ key_string_lookup_string(const char *string) string++; } modifiers |= key_string_get_modifiers(&string); - if (string[0] == '\0') + if (string == NULL || string[0] == '\0') return (KEYC_UNKNOWN); /* Is this a standard ASCII key? */ diff --git a/server-client.c b/server-client.c index ea63a979..6030d504 100644 --- a/server-client.c +++ b/server-client.c @@ -690,6 +690,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) @@ -802,8 +803,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; } @@ -1837,7 +1837,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 *); |