- works with test ansi tty, but will need a rethink when we start
authorDan Lynch <danjlynch@users.sourceforge.net>
Tue, 27 Jun 2006 17:15:34 +0000 (17:15 +0000)
committerDan Lynch <danjlynch@users.sourceforge.net>
Tue, 27 Jun 2006 17:15:34 +0000 (17:15 +0000)
getting key_ codes instead

src/hci/mucurses/kb.c

index 5f113d9..114e6b3 100644 (file)
@@ -94,7 +94,8 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
 
        _str = str;
 
-       while ( ( ( c = wgetch( win ) ) != '\n' ) && !( n == 0 ) ) {
+       while (!( n == 0 ) ) {
+               c = wgetch( win );
                if ( c >= 0401 && c <= 0633 ) {
                        switch(c) {
                        case KEY_LEFT :
@@ -107,7 +108,10 @@ int wgetnstr ( WINDOW *win, char *str, int n ) {
                                *_str = '\0';
                                break;
                        }
-               } else { // *should* only be ASCII chars now
+               } else if ( c == '\n' ) {
+                       *_str = '\0';
+                       break;
+               }else { // *should* only be ASCII chars now
                        *(_str++) = (char)c;
                        n--;
                }