diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-02-10 11:20:42 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2014-02-10 11:20:42 +0000 |
commit | acc5ed84ab007a73ee1a15974db63ab28196a3de (patch) | |
tree | ed43142e4e899b413980ca5e53aabe6a0d7437a3 | |
parent | d3bbfd4a2843b5ab42128304b812297cd72c19ef (diff) |
The last fix to xterm keys meant that some keys such as \033OA were
being wrongly treated as partial matches. So both check xterm keys after
standard keys and only wildcard the minimum required ('1' to
'8'). Problems reported by Ralf Horstmann and Tim van der Molen.
-rw-r--r-- | usr.bin/tmux/tty-keys.c | 20 | ||||
-rw-r--r-- | usr.bin/tmux/xterm-keys.c | 6 |
2 files changed, 14 insertions, 12 deletions
diff --git a/usr.bin/tmux/tty-keys.c b/usr.bin/tmux/tty-keys.c index f3adf16d380..a14f68ffb69 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.61 2013/10/10 11:57:52 nicm Exp $ */ +/* $OpenBSD: tty-keys.c,v 1.62 2014/02/10 11:20:41 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -479,6 +479,15 @@ tty_keys_next(struct tty *tty) goto partial_key; } + /* Look for matching key string and return if found. */ + tk = tty_keys_find(tty, buf, len, &size); + if (tk != NULL) { + if (tk->next != NULL) + goto partial_key; + key = tk->key; + goto complete_key; + } + /* Try to parse a key with an xterm-style modifier. */ switch (xterm_keys_find(buf, len, &size, &key)) { case 0: /* found */ @@ -489,15 +498,6 @@ tty_keys_next(struct tty *tty) goto partial_key; } - /* Look for matching key string and return if found. */ - tk = tty_keys_find(tty, buf, len, &size); - if (tk != NULL) { - if (tk->next != NULL) - goto partial_key; - key = tk->key; - goto complete_key; - } - first_key: /* Is this a meta key? */ if (len >= 2 && buf[0] == '\033') { diff --git a/usr.bin/tmux/xterm-keys.c b/usr.bin/tmux/xterm-keys.c index 2d6b601fb3d..235a7107aa9 100644 --- a/usr.bin/tmux/xterm-keys.c +++ b/usr.bin/tmux/xterm-keys.c @@ -1,4 +1,4 @@ -/* $OpenBSD: xterm-keys.c,v 1.12 2014/01/31 11:20:28 nicm Exp $ */ +/* $OpenBSD: xterm-keys.c,v 1.13 2014/02/10 11:20:41 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -131,7 +131,9 @@ xterm_keys_match(const char *template, const char *buf, size_t len) pos = 0; do { - if (*template != '_' && buf[pos] != *template) + if (*template == '_' && buf[pos] >= '1' && buf[pos] <= '8') + continue; + if (buf[pos] != *template) return (-1); } while (*++template != '\0' && ++pos != len); |