summaryrefslogtreecommitdiffstats
path: root/tty-keys.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-12-01 07:59:40 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-12-01 07:59:40 +0000
commitf27fefd7b84633be67b7702c616ed398c87e8ec6 (patch)
treeaedb466ccdec92ee2b5478ef6010b5eac93f27d6 /tty-keys.c
parent29a5931c6a352f12fe4bcc1cb72cb96e073ddca6 (diff)
Look for mice and xterm keys before standard function keys as they are less
likely to be partial versions.
Diffstat (limited to 'tty-keys.c')
-rw-r--r--tty-keys.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/tty-keys.c b/tty-keys.c
index 1319e09f..deb2b317 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -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--;