summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2013-03-25 11:44:16 +0000
committerNicholas Marriott <nicm@openbsd.org>2013-03-25 11:44:16 +0000
commite2295014d9c761381999e023872c22ea4827e736 (patch)
tree270047563d349b61b4d51f3dab26971edcc5cdea
parent43fb9835fabee828c46d54b656a90a77eb756384 (diff)
Process ^[ as meta when a partial key is found.
-rw-r--r--tty-keys.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tty-keys.c b/tty-keys.c
index fc79c89b..33539d15 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -82,6 +82,13 @@ const struct tty_default_key_raw tty_default_raw_keys[] = {
{ "\033[C", KEYC_RIGHT },
{ "\033[D", KEYC_LEFT },
+ /* Other (xterm) "cursor" keys. */
+ { "\033OH", KEYC_HOME },
+ { "\033OF", KEYC_END },
+
+ { "\033[H", KEYC_HOME },
+ { "\033[F", KEYC_END },
+
/* rxvt-style arrow + modifier keys. */
{ "\033Oa", KEYC_UP|KEYC_CTRL },
{ "\033Ob", KEYC_DOWN|KEYC_CTRL },
@@ -491,6 +498,7 @@ tty_keys_next(struct tty *tty)
goto complete_key;
}
+first_key:
/* Is this a meta key? */
if (len >= 2 && buf[0] == '\033') {
if (buf[1] != '\033') {
@@ -511,7 +519,6 @@ tty_keys_next(struct tty *tty)
}
}
-first_key:
/* No key found, take first. */
key = (u_char) *buf;
size = 1;