Sync OpenBSD patchset 193:

Accept and print "Enter" and "Escape" for keys rather than C-m and C-[.
pull/1/head
Tiago Cunha 2009-07-28 23:13:00 +00:00
parent de7483a114
commit deaba44835
1 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $Id: key-string.c,v 1.21 2009-07-28 22:37:02 tcunha Exp $ */
/* $Id: key-string.c,v 1.22 2009-07-28 23:13:00 tcunha Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -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);
}