summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2011-01-23 11:04:25 +0000
committernicm <nicm@openbsd.org>2011-01-23 11:04:25 +0000
commit7fe0499ff0eaa5c16b0284ef4f47b4d6604f3f9a (patch)
tree33f966a4f19585a927d739f07a172a6a6dff29f5
parentSet $TMUX without the session when background jobs are run. (diff)
downloadwireguard-openbsd-7fe0499ff0eaa5c16b0284ef4f47b4d6604f3f9a.tar.xz
wireguard-openbsd-7fe0499ff0eaa5c16b0284ef4f47b4d6604f3f9a.zip
Allow top-bit-set characters to be used for key bindings, from Tiago
Cunha.
-rw-r--r--usr.bin/tmux/key-string.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/key-string.c b/usr.bin/tmux/key-string.c
index 28ab8f10733..6dc17d8ad2f 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.19 2011/01/01 03:43:20 nicm Exp $ */
+/* $OpenBSD: key-string.c,v 1.20 2011/01/23 11:04:25 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -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);
}