From: ewt Date: Mon, 17 Jun 1996 15:16:10 +0000 (+0000) Subject: added NEWT_ENTRY_RETURNEXIT X-Git-Tag: 0-1~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e263bd42e43ddc93f213c8ae9e5ea24397ca8c7f;p=thirdparty%2Fnewt.git added NEWT_ENTRY_RETURNEXIT --- diff --git a/entry.c b/entry.c index 1341d1b..aebea4c 100644 --- a/entry.c +++ b/entry.c @@ -85,6 +85,7 @@ newtComponent newtEntry(int left, int top, char * initialValue, int width, if (initialValue) { strcpy(en->buf, initialValue); en->bufUsed = strlen(initialValue); + en->cursorPosition = en->bufUsed; } return co; @@ -189,6 +190,12 @@ static struct eventResult entryHandleKey(struct newtComponent * co, int key) { er.result = ER_SWALLOWED; switch (key) { + case '\r': /* Return */ + if (en->flags & NEWT_ENTRY_RETURNEXIT) { + er.result = ER_EXITFORM; + } + break; + case '\001': /* ^A */ case NEWT_KEY_HOME: en->cursorPosition = 0;