summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorMicah Cowan <micah@micah.cowan.name>2010-06-05 06:27:19 +0000
committerMicah Cowan <micah@micah.cowan.name>2010-06-05 06:27:19 +0000
commitd27956f16007956883625859bafec6c34212cc35 (patch)
treecfff03e60bba715a0062c52c3623cffa5d0c4ce5 /key-string.c
parente334deb8729dbfd8546b1076d36699e0e434f3a5 (diff)
Allow C-Space to work correctly once again, and forbid nonsensical combinations such as C-Enter or C-Escape.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/key-string.c b/key-string.c
index 613c9821..715324f1 100644
--- a/key-string.c
+++ b/key-string.c
@@ -1,4 +1,4 @@
-/* $Id: key-string.c,v 1.32 2010-05-14 14:21:07 tcunha Exp $ */
+/* $Id: key-string.c,v 1.33 2010-06-05 06:27:19 micahcowan Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}