summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2011-01-23 11:04:25 +0000
committerNicholas Marriott <nicm@openbsd.org>2011-01-23 11:04:25 +0000
commit3872e2484741d5b7e9b7facc0d364408ee548f9e (patch)
treedbf1288fd668761066c12a382f07707ffe937661 /key-string.c
parentb8023044c35f3099e67793e3573e9e001a43b1fe (diff)
Allow top-bit-set characters to be used for key bindings, from Tiago
Cunha.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/key-string.c b/key-string.c
index 2d768aef..ad7d4edd 100644
--- a/key-string.c
+++ b/key-string.c
@@ -147,7 +147,7 @@ key_string_lookup_string(const char *string)
/* Is this a standard ASCII key? */
if (string[1] == '\0') {
key = (u_char) string[0];
- if (key < 32 || key > 126)
+ if (key < 32 || key == 127 || key > 255)
return (KEYC_NONE);
} else {
/* Otherwise look the key up in the table. */
@@ -213,7 +213,7 @@ key_string_lookup_key(int key)
}
/* Invalid keys are errors. */
- if (key >= 127)
+ if (key == 127 || key > 255)
return (NULL);
/* Check for standard or control key. */
@@ -225,7 +225,9 @@ key_string_lookup_key(int key)
} else if (key >= 32 && key <= 126) {
tmp[0] = key;
tmp[1] = '\0';
- }
+ } else if (key >= 128)
+ xsnprintf(tmp, sizeof tmp, "\\%o", key);
+
strlcat(out, tmp, sizeof out);
return (out);
}