X-Git-Url: https://fleuret.org/cgi-bin/gitweb/gitweb.cgi?a=blobdiff_plain;f=selector.cc;h=af8ef84bbca6fb7ab9d83b86b5498dae7ec93086;hb=b5301bfe1c4b110dad8788ea822acbd785e9ef7a;hp=c387c68cf99716f20b191c535525d096c89180ec;hpb=ad25fa46db2e693f887638a4afa35555cd1e5646;p=selector.git diff --git a/selector.cc b/selector.cc index c387c68..af8ef84 100644 --- a/selector.cc +++ b/selector.cc @@ -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) { @@ -208,7 +191,7 @@ void update_screen(int *current_line, int *temporary_line, int motion, addstr("\n"); - int nb_printed_lines = 1; + int nb_printed_lines = 0; // Here new_line is either a line number matching the patterns, or -1 @@ -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++; @@ -293,14 +276,14 @@ void update_screen(int *current_line, int *temporary_line, int motion, *temporary_line = new_line; - if(nb_printed_lines == 1) { + if(nb_printed_lines == 0) { addnstr("[no selection]\n", console_width); } // Draw the modeline sprintf(buffer, "%d/%d pattern: %s", - nb_printed_lines - 1, + nb_printed_lines, nb_lines, pattern_list);