summaryrefslogtreecommitdiffstats
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2018-07-17 18:02:40 +0000
committernicm <nicm>2018-07-17 18:02:40 +0000
commit969af935f33b5850e64ec9f5b8f9d0acf83bb32d (patch)
tree2807b92389dda069742959f8027fa729943202b6 /server-client.c
parent0d88f8a78bc0d91ab6fa53c9109f7316bfe5ffbb (diff)
When a key isn't in the first table, we need to try the same key again
not the any key. Also rename some labels. Fixes GitHub issue 1406 reeported by Mark Kelly.
Diffstat (limited to 'server-client.c')
-rw-r--r--server-client.c25
1 files changed, 15 insertions, 10 deletions
diff --git a/server-client.c b/server-client.c
index c81edcc7..46b90ccb 100644
--- a/server-client.c
+++ b/server-client.c
@@ -884,11 +884,11 @@ server_client_handle_key(struct client *c, key_code key)
/* Forward mouse keys if disabled. */
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
- goto forward;
+ goto forward_key;
/* Treat everything as a regular key when pasting is detected. */
if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s))
- goto forward;
+ goto forward_key;
/*
* Work out the current key table. If the pane is in a mode, use
@@ -903,12 +903,12 @@ server_client_handle_key(struct client *c, key_code key)
table = c->keytable;
first = table;
+table_changed:
/*
* The prefix always takes precedence and forces a switch to the prefix
* table, unless we are already there.
*/
key0 = (key & ~KEYC_XTERM);
-retry:
if ((key0 == (key_code)options_get_number(s->options, "prefix") ||
key0 == (key_code)options_get_number(s->options, "prefix2")) &&
strcmp(table->name, "prefix") != 0) {
@@ -926,6 +926,7 @@ retry:
if (c->flags & CLIENT_REPEAT)
log_debug("currently repeating");
+try_again:
/* Try to see if there is a key binding in the current table. */
bd_find.key = key0;
bd = RB_FIND(key_bindings, &table->key_bindings, &bd_find);
@@ -941,7 +942,7 @@ retry:
c->flags &= ~CLIENT_REPEAT;
server_status_client(c);
table = c->keytable;
- goto retry;
+ goto table_changed;
}
log_debug("found in key table %s", table->name);
@@ -976,21 +977,25 @@ retry:
}
/*
- * No match in this table. If not in the root table or if repeating,
- * switch the client back to the root table and try again.
+ * No match, try the ANY key.
*/
- log_debug("not found in key table %s", table->name);
if (key0 != KEYC_ANY) {
key0 = KEYC_ANY;
- goto retry;
+ goto try_again;
}
+
+ /*
+ * No match in this table. If not in the root table or if repeating,
+ * switch the client back to the root table and try again.
+ */
+ log_debug("not found in key table %s", table->name);
if (!server_client_is_default_key_table(c, table) ||
(c->flags & CLIENT_REPEAT)) {
server_client_set_key_table(c, NULL);
c->flags &= ~CLIENT_REPEAT;
server_status_client(c);
table = c->keytable;
- goto retry;
+ goto table_changed;
}
/*
@@ -1003,7 +1008,7 @@ retry:
return;
}
-forward:
+forward_key:
if (c->flags & CLIENT_READONLY)
return;
if (wp != NULL)