From 9ebbe2cca7c0b36079d3ab9f53174278d06e189e Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 22 Aug 2024 05:39:55 +0000 Subject: [PATCH] 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@. --- key-string.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/key-string.c b/key-string.c index 04f0e5bf..a97827f8 100644 --- a/key-string.c +++ b/key-string.c @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -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);