From 11e280670dac60d322d33c132f92c885ab4e2331 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Tue, 27 Jun 2006 17:15:34 +0000 Subject: [PATCH] - works with test ansi tty, but will need a rethink when we start getting key_ codes instead --- src/hci/mucurses/kb.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/hci/mucurses/kb.c b/src/hci/mucurses/kb.c index 5f113d9c..114e6b38 100644 --- a/src/hci/mucurses/kb.c +++ b/src/hci/mucurses/kb.c @@ -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--; }