src/input.c

changeset 31
ed440bcd9740
parent 30
a285ee393860
child 32
8a0b85303ee8
     1.1 --- a/src/input.c	Mon Apr 07 17:39:46 2014 +0200
     1.2 +++ b/src/input.c	Tue Apr 08 21:13:28 2014 +0200
     1.3 @@ -28,6 +28,7 @@
     1.4   */
     1.5  
     1.6  #include "input.h"
     1.7 +#include <ctype.h>
     1.8  
     1.9  void init_colorpairs() {
    1.10      init_pair(COL_YB, COLOR_YELLOW, COLOR_BLUE);
    1.11 @@ -70,6 +71,7 @@
    1.12      static size_t pos = 0;
    1.13      
    1.14      if (*str == '\0') {
    1.15 +        memset(str, 0, len);
    1.16          pos = 0;
    1.17      }
    1.18      
    1.19 @@ -88,7 +90,7 @@
    1.20              str[--pos] = '\0';
    1.21              break;
    1.22          default:
    1.23 -            if (c < 255 && pos < len-1) {
    1.24 +            if (isprint(c) && pos < len-1) {
    1.25                  str[pos++] = (char) c;
    1.26              }
    1.27          }

mercurial