summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/tty-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2009-12-01 07:59:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2009-12-01 07:59:41 +0000
commitc0da60c219bfa45173cf47cb2a96170b5eb1060e (patch)
treec14c68b890885c06c8104527a7668cf76eb2480d /usr.bin/tmux/tty-keys.c
parent9a02b390bcd3f76b236a19abcd8ffdac0f75a342 (diff)
Look for mice and xterm keys before standard function keys as they are less
likely to be partial versions.
Diffstat (limited to 'usr.bin/tmux/tty-keys.c')
-rw-r--r--usr.bin/tmux/tty-keys.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c
index ec6d05c7062..f96493a23f1 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.25 2009/11/30 16:44:03 nicm Exp $ */
+/* $OpenBSD: tty-keys.c,v 1.26 2009/12/01 07:59:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -453,14 +453,7 @@ tty_keys_next(struct tty *tty)
goto handle_key;
}
- /* Look for matching key string and return if found. */
- tk = tty_keys_find(tty, buf + 1, len - 1, &size);
- if (tk != NULL) {
- key = tk->key;
- goto found_key;
- }
-
- /* Not found. Is this a mouse key press? */
+ /* Is this a mouse key press? */
switch (tty_keys_mouse(buf, len, &size, &mouse)) {
case 0: /* yes */
evbuffer_drain(tty->event->input, size);
@@ -472,7 +465,7 @@ tty_keys_next(struct tty *tty)
goto partial_key;
}
- /* Not found. Try to parse a key with an xterm-style modifier. */
+ /* Try to parse a key with an xterm-style modifier. */
switch (xterm_keys_find(buf, len, &size, &key)) {
case 0: /* found */
evbuffer_drain(tty->event->input, size);
@@ -483,6 +476,13 @@ tty_keys_next(struct tty *tty)
goto partial_key;
}
+ /* Look for matching key string and return if found. */
+ tk = tty_keys_find(tty, buf + 1, len - 1, &size);
+ if (tk != NULL) {
+ key = tk->key;
+ goto found_key;
+ }
+
/* Skip the escape. */
buf++;
len--;