diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-08-22 05:39:56 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2024-08-22 05:39:56 +0000 |
commit | e826a6e4ca1ca2921f32cf1ee62c8c79f136e097 (patch) | |
tree | 949eedf8c4c93d053a462b1bed4148675d70c5cd /usr.bin/tmux/key-string.c | |
parent | 5ef0bdba79c12ec0e4e6c18d7cb747542afccbbf (diff) |
Short Ctrl keys like ^A need to be converted to lowercase so they end up
as 'a'|KEYC_CTRL to match the new internal representation. Problem
reported by naddy@.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-rw-r--r-- | usr.bin/tmux/key-string.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c index d9ba95afae6..0c96738bb15 100644 --- a/usr.bin/tmux/key-string.c +++ b/usr.bin/tmux/key-string.c @@ -1,4 +1,4 @@ -/* $OpenBSD: key-string.c,v 1.72 2024/08/21 04:17:09 nicm Exp $ */ +/* $OpenBSD: key-string.c,v 1.73 2024/08/22 05:39:55 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -18,6 +18,7 @@ #include <sys/types.h> +#include <ctype.h> #include <stdlib.h> #include <string.h> #include <wchar.h> @@ -241,7 +242,7 @@ key_string_get_modifiers(const char **string) key_code key_string_lookup_string(const char *string) { - key_code key, modifiers; + key_code key, modifiers = 0; u_int u, i; struct utf8_data ud, *udp; enum utf8_state more; @@ -276,14 +277,18 @@ key_string_lookup_string(const char *string) } free(udp); return (uc); + } - /* Check for modifiers. */ - modifiers = 0; + /* Check for short Ctrl key. */ if (string[0] == '^' && string[1] != '\0') { + if (string[2] == '\0') + return (tolower((u_char)string[1])|KEYC_CTRL); modifiers |= KEYC_CTRL; string++; } + + /* Check for modifiers. */ modifiers |= key_string_get_modifiers(&string); if (string == NULL || string[0] == '\0') return (KEYC_UNKNOWN); |