]> git.ipfire.org Git - thirdparty/newt.git/commitdiff
added NEWT_ENTRY_RETURNEXIT
authorewt <ewt>
Mon, 17 Jun 1996 15:16:10 +0000 (15:16 +0000)
committerewt <ewt>
Mon, 17 Jun 1996 15:16:10 +0000 (15:16 +0000)
entry.c

diff --git a/entry.c b/entry.c
index 1341d1b76a320b2a5173a824e6e748801e41c8ed..aebea4c83bd72374dc0c1d02dd6022223308f91d 100644 (file)
--- 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;