From: ewt Date: Fri, 2 Aug 1996 18:44:58 +0000 (+0000) Subject: 1) added NEWT_KEY_F1, NEWT_KEY_F12 X-Git-Tag: v0-9~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2db1ec9ffc696ea3011b933709c1b485f04914e1;p=thirdparty%2Fnewt.git 1) added NEWT_KEY_F1, NEWT_KEY_F12 2) doesn't coredump when escape sequences come in quickly --- diff --git a/newt.c b/newt.c index 330a103..60a1f2a 100644 --- a/newt.c +++ b/newt.c @@ -66,6 +66,9 @@ static struct keymap keymap[] = { { "\033[5~", NEWT_KEY_PGUP, NULL }, { "\033[6~", NEWT_KEY_PGDN, NULL }, + { "\033[11~", NEWT_KEY_F1, NULL }, + { "\033[24~", NEWT_KEY_F12, NULL }, + { NULL, 0, NULL }, /* LEAVE this one */ }; static char keyPrefix = '\033'; @@ -161,6 +164,12 @@ int newtGetKey(void) { *chptr++ = key; while (SLang_input_pending(5)) { key = SLang_getkey(); + if (key == keyPrefix) { + /* he hit unknown keys too many times -- start over */ + memset(buf, 0, sizeof(buf)); + chptr = buf; + } + *chptr++ = key; /* this search should use bsearch(), but when we only look through