summaryrefslogtreecommitdiff
path: root/usr.bin/tmux
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2010-06-05 15:51:54 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2010-06-05 15:51:54 +0000
commit6d3d41063ec9222aa2ea625065d937f066011c22 (patch)
treea29b5739a66a00c769168f05d7e8b1602b41274a /usr.bin/tmux
parent068355f3fa5971dffc446b364b34bcc337c3620f (diff)
Fix binding of C-Space/C-@, from Micah Cowan.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r--usr.bin/tmux/key-string.c41
1 files changed, 20 insertions, 21 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c
index 38eb77d6067..07ebb20cf11 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.16 2010/05/03 09:38:03 mcbride Exp $ */
+/* $OpenBSD: key-string.c,v 1.17 2010/06/05 15:51:53 nicm 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);
}