Commit Diff


commit - d43ebc7845ab829afbfebf96cecf9c86b663d704
commit + 6beff8a2df63745c1902d2551b8233e603ca317b
blob - 307f1cb33fd8c0893098e1c188b586f49a18004a
blob + 8da95c460b0cb0f5ca1ea8fb6c015e029a5fb445
--- rover.c
+++ rover.c
@@ -1,6 +1,7 @@
 #include <stdlib.h>
-#include <string.h>
 #include <stdint.h>
+#include <ctype.h>
+#include <string.h>
 #include <sys/types.h>  /* ? */
 #include <stdio.h>      /* FILENAME_MAX */
 #include <locale.h>     /* setlocale(), LC_ALL */
@@ -373,10 +374,11 @@ main()
                 else if (ch == killc) {
                     length = 0;
                     SEARCH[0] = '\0';
+                    SEARCH[1] = '\0';
                     rover.fsel = oldsel;
                     rover.scroll = oldscroll;
                 }
-                else if (length < SEARCHSZ - 2) {
+                else if (length < SEARCHSZ - 2 && isprint(ch)) {
                     SEARCH[length++] = ch;
                     SEARCH[length+1] = '\0';
                 }