summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2010-06-05 15:51:53 +0000
committerNicholas Marriott <nicm@openbsd.org>2010-06-05 15:51:53 +0000
commitb88ec14f0ee93e5134e33034ac93b2229bcc8beb (patch)
tree9f5e371e3a3d8c2d0299a32d1f4b24d9cb30934c /key-string.c
parentcc724f327a14c607927c8ef27c4b72311a301271 (diff)
Fix binding of C-Space/C-@, from Micah Cowan.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c39
1 files changed, 19 insertions, 20 deletions
diff --git a/key-string.c b/key-string.c
index 65d669bf..62717b2f 100644
--- a/key-string.c
+++ b/key-string.c
@@ -149,29 +149,28 @@ key_string_lookup_string(const char *string)
key = (u_char) string[0];
if (key < 32 || key > 126)
return (KEYC_NONE);
+ } else {
+ /* Otherwise look the key up in the table. */
+ key = key_string_search_table(string);
+ if (key == KEYC_NONE)
+ return (KEYC_NONE);
+ }
- /* Convert the standard control keys. */
- if (modifiers & KEYC_CTRL) {
- if (key >= 97 && key <= 122)
- key -= 96;
- else if (key >= 64 && key <= 95)
- key -= 64;
- else if (key == 32)
- key = 0;
- else if (key == 63)
- key = KEYC_BSPACE;
- else
- return (KEYC_NONE);
- modifiers &= ~KEYC_CTRL;
- }
-
- return (key | modifiers);
+ /* Convert the standard control keys. */
+ if (key < KEYC_BASE && (modifiers & KEYC_CTRL)) {
+ if (key >= 97 && key <= 122)
+ key -= 96;
+ else if (key >= 64 && key <= 95)
+ key -= 64;
+ else if (key == 32)
+ key = 0;
+ else if (key == 63)
+ key = KEYC_BSPACE;
+ else
+ return (KEYC_NONE);
+ modifiers &= ~KEYC_CTRL;
}
- /* Otherwise look the key up in the table. */
- key = key_string_search_table(string);
- if (key == KEYC_NONE)
- return (KEYC_NONE);
return (key | modifiers);
}