Fixed the odd number of lines bug.
[selector.git] / selector.cc
index f4d7930..af8ef84 100644 (file)
@@ -58,23 +58,6 @@ int remove_duplicates = 0;
 
 //////////////////////////////////////////////////////////////////////
 
-// int test_and_set_hash(char *s, char **hashed, int hash_size) {
-  // uint32_t code = 0, mask;
-  // int result;
-
-  // for(int k = 0; s[k]; k++) {
-    // code += ((uint32_t) (s[k])) << (8 * k%4);
-  // }
-
-  // code = code%hash_table_size;
-
-  // if(hashed[code]) {
-  // } else {
-  // }
-// }
-
-//////////////////////////////////////////////////////////////////////
-
 // This looks severely Linux-only ...
 
 void inject_into_tty_buffer(char *line) {
@@ -231,7 +214,7 @@ void update_screen(int *current_line, int *temporary_line, int motion,
         }
       }
 
-      if(last_line < nb_lines - 1) {
+      if(nb_match < console_height - 1 && last_line < nb_lines - 1) {
         last_line++;
         while(last_line < nb_lines - 1 && !match(lines[last_line], nb_patterns, patterns)) {
           last_line++;