summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/key-string.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2010-06-05 15:51:53 +0000
committernicm <nicm@openbsd.org>2010-06-05 15:51:53 +0000
commit9645da3705ea32c3abb2edb5b8d845a7a823b285 (patch)
tree7fb7dfba82734346ec87305b4870e8b73120ab3b /usr.bin/tmux/key-string.c
parentMake start-of-line work the same as end-of-line on wrapped lines (jump (diff)
downloadwireguard-openbsd-9645da3705ea32c3abb2edb5b8d845a7a823b285.tar.xz
wireguard-openbsd-9645da3705ea32c3abb2edb5b8d845a7a823b285.zip
Fix binding of C-Space/C-@, from Micah Cowan.
Diffstat (limited to 'usr.bin/tmux/key-string.c')
-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);
}