mirror of
https://github.com/tmux/tmux.git
synced 2026-04-18 08:59:31 +00:00
Reorganize structure of key_code so that it can be built directly by
bitshifts rather than a load of huge switches, from Dane Jensen in GitHub issue 4953.
This commit is contained in:
@@ -202,7 +202,7 @@ key_string_search_table(const char *string)
|
||||
return (key_string_table[i].key);
|
||||
}
|
||||
|
||||
if (sscanf(string, "User%u", &user) == 1 && user < KEYC_NUSER)
|
||||
if (sscanf(string, "User%u", &user) == 1 && user <= KEYC_NUSER)
|
||||
return (KEYC_USER + user);
|
||||
|
||||
return (KEYC_UNKNOWN);
|
||||
@@ -418,7 +418,7 @@ key_string_lookup_key(key_code key, int with_flags)
|
||||
s = "MouseMoveBorder";
|
||||
goto append;
|
||||
}
|
||||
if (key >= KEYC_USER && key < KEYC_USER_END) {
|
||||
if (KEYC_IS_USER(key)) {
|
||||
snprintf(tmp, sizeof tmp, "User%u", (u_int)(key - KEYC_USER));
|
||||
strlcat(out, tmp, sizeof out);
|
||||
goto out;
|
||||
|
||||
Reference in New Issue
Block a user