summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2009-10-26 17:46:33 +0000
committernicm <nicm@openbsd.org>2009-10-26 17:46:33 +0000
commitbbf9de78822cd195f98a48794b61c8a00be1caee (patch)
treec381c2222d9bfc79cba1abe11e4038c9e3540373 /usr.bin/tmux/tty-keys.c
parentReplace pool_get() + bzero() with pool_get(..., PR_ZERO). (diff)
downloadwireguard-openbsd-bbf9de78822cd195f98a48794b61c8a00be1caee.tar.xz
wireguard-openbsd-bbf9de78822cd195f98a48794b61c8a00be1caee.zip
Rewrite xterm-keys code (both input and output) so that works (doesn't always
output the same modifiers, accepts all the possible input keys) and is more understandable.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r--usr.bin/tmux/tty-keys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index ecc4eb051b6..de4ae1bb6c3 100644
--- a/usr.bin/tmux/tty-keys.c
+++ b/usr.bin/tmux/tty-keys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty-keys.c,v 1.10 2009/10/26 16:00:51 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.11 2009/10/26 17:46:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -341,6 +341,13 @@ tty_keys_next(struct tty *tty, int *key, struct mouse_event *mouse)
goto found;
}
+ /* Not found. Try to parse a key with an xterm-style modifier. */
+ *key = xterm_keys_find(buf, len, &size);
+ if (*key != KEYC_NONE) {
+ buffer_remove(tty->in, size);
+ goto found;
+ }
+
/* Escape but no key string. If the timer isn't started, start it. */
if (!(tty->flags & TTY_ESCAPE)) {
tv.tv_sec = 0;