Removed a bug when the input file is empty.
authorFrancois Fleuret <francois@fleuret.org>
Tue, 31 Mar 2009 19:46:45 +0000 (21:46 +0200)
committerFrancois Fleuret <francois@fleuret.org>
Tue, 31 Mar 2009 19:46:45 +0000 (21:46 +0200)
selector.cc

index 3f8aba7..3ffccc1 100644 (file)
@@ -228,8 +228,7 @@ void update_screen(int *current_line, int *temporary_line, int motion,
 
   if(matcher.regexp_error) {
     addstr("[regexp error]");
-  } else {
-
+  } else if(nb_lines > 0) {
     int new_line;
     if(match(lines[*current_line], &matcher)) {
       new_line = *current_line;
@@ -349,6 +348,8 @@ void update_screen(int *current_line, int *temporary_line, int motion,
     if(nb_printed_lines == 0) {
       addnstr("[no selection]\n", console_width);
     }
+  } else {
+    addnstr("[empty choice]\n", console_width);
   }
 
   // Draw the modeline