summaryrefslogtreecommitdiffstats
path: root/key-string.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2009-07-28 09:18:01 +0000
committerNicholas Marriott <nicm@openbsd.org>2009-07-28 09:18:01 +0000
commit9e5d585ba4b0af6badf559cc7b275a23be8947c2 (patch)
treed20cc67dbd6e255042ee853472ff70746596b9e0 /key-string.c
parent86785004baf4086816b5d6684b9d0e4c56b58ea6 (diff)
Accept and print "Enter" and "Escape" for keys rather than C-m and C-[.
Diffstat (limited to 'key-string.c')
-rw-r--r--key-string.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/key-string.c b/key-string.c
index 5c8ce5b3..68a57f8b 100644
--- a/key-string.c
+++ b/key-string.c
@@ -58,6 +58,8 @@ struct {
{ "Tab", '\011' },
{ "BTab", KEYC_BTAB },
{ "BSpace", KEYC_BSPACE },
+ { "Enter", '\r' },
+ { "Escape", '\033' },
/* Arrow keys. */
{ "Up", KEYC_UP },
@@ -177,6 +179,11 @@ key_string_lookup_key(int key)
return (tmp2);
}
+ for (i = 0; i < nitems(key_string_table); i++) {
+ if (key == key_string_table[i].key)
+ return (key_string_table[i].string);
+ }
+
if (key >= 32 && key <= 255) {
tmp[0] = key;
tmp[1] = '\0';
@@ -191,9 +198,5 @@ key_string_lookup_key(int key)
return (tmp);
}
- for (i = 0; i < nitems(key_string_table); i++) {
- if (key == key_string_table[i].key)
- return (key_string_table[i].string);
- }
return (NULL);
}