Skip to content

Commit 5fc2d4a

Browse files
committed
Merge branch 'obsd-master'
2 parents 4f04b20 + 969af93 commit 5fc2d4a

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

server-client.c

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -882,11 +882,11 @@ server_client_handle_key(struct client *c, key_code key)
882882

883883
/* Forward mouse keys if disabled. */
884884
if (KEYC_IS_MOUSE(key) && !options_get_number(s->options, "mouse"))
885-
goto forward;
885+
goto forward_key;
886886

887887
/* Treat everything as a regular key when pasting is detected. */
888888
if (!KEYC_IS_MOUSE(key) && server_client_assume_paste(s))
889-
goto forward;
889+
goto forward_key;
890890

891891
/*
892892
* Work out the current key table. If the pane is in a mode, use
@@ -901,12 +901,12 @@ server_client_handle_key(struct client *c, key_code key)
901901
table = c->keytable;
902902
first = table;
903903

904+
table_changed:
904905
/*
905906
* The prefix always takes precedence and forces a switch to the prefix
906907
* table, unless we are already there.
907908
*/
908909
key0 = (key & ~KEYC_XTERM);
909-
retry:
910910
if ((key0 == (key_code)options_get_number(s->options, "prefix") ||
911911
key0 == (key_code)options_get_number(s->options, "prefix2")) &&
912912
strcmp(table->name, "prefix") != 0) {
@@ -924,6 +924,7 @@ server_client_handle_key(struct client *c, key_code key)
924924
if (c->flags & CLIENT_REPEAT)
925925
log_debug("currently repeating");
926926

927+
try_again:
927928
/* Try to see if there is a key binding in the current table. */
928929
bd_find.key = key0;
929930
bd = RB_FIND(key_bindings, &table->key_bindings, &bd_find);
@@ -939,7 +940,7 @@ server_client_handle_key(struct client *c, key_code key)
939940
c->flags &= ~CLIENT_REPEAT;
940941
server_status_client(c);
941942
table = c->keytable;
942-
goto retry;
943+
goto table_changed;
943944
}
944945
log_debug("found in key table %s", table->name);
945946

@@ -974,21 +975,25 @@ server_client_handle_key(struct client *c, key_code key)
974975
}
975976

976977
/*
977-
* No match in this table. If not in the root table or if repeating,
978-
* switch the client back to the root table and try again.
978+
* No match, try the ANY key.
979979
*/
980-
log_debug("not found in key table %s", table->name);
981980
if (key0 != KEYC_ANY) {
982981
key0 = KEYC_ANY;
983-
goto retry;
982+
goto try_again;
984983
}
984+
985+
/*
986+
* No match in this table. If not in the root table or if repeating,
987+
* switch the client back to the root table and try again.
988+
*/
989+
log_debug("not found in key table %s", table->name);
985990
if (!server_client_is_default_key_table(c, table) ||
986991
(c->flags & CLIENT_REPEAT)) {
987992
server_client_set_key_table(c, NULL);
988993
c->flags &= ~CLIENT_REPEAT;
989994
server_status_client(c);
990995
table = c->keytable;
991-
goto retry;
996+
goto table_changed;
992997
}
993998

994999
/*
@@ -1001,7 +1006,7 @@ server_client_handle_key(struct client *c, key_code key)
10011006
return;
10021007
}
10031008

1004-
forward:
1009+
forward_key:
10051010
if (c->flags & CLIENT_READONLY)
10061011
return;
10071012
if (wp != NULL)

0 commit comments

Comments
 (0)