Fixed a bug for non-full-width line display.
[selector.git] / selector.c
index 72f1aa1..2d81071 100644 (file)
@@ -191,7 +191,7 @@ void usage(FILE *out) {
   fprintf(out, " -a, --case-sensitive\n");
   fprintf(out, "         start in case sensitive mode\n");
   fprintf(out, " -j, --show-long-lines\n");
-  fprintf(out, "         print three dots at the end of truncated lines\n");
+  fprintf(out, "         print a long-line indicator at the end of truncated lines\n");
   fprintf(out, " -y, --show-hits\n");
   fprintf(out, "         highlight the matching substrings\n");
   fprintf(out, " -u, --upper-case-makes-case-sensitive\n");
@@ -764,9 +764,10 @@ void update_screen(int *current_focus_line, int *displayed_focus_line,
               addnstr("\\", 1);
               attroff(attr_focus_line);
             } else {
-              buffer[k++] = '\n';
-              buffer[k++] = '\0';
-
+              if(k < console_width) {
+                buffer[k++] = '\n';
+                buffer[k++] = '\0';
+              }
               print_string_with_switches(buffer, k,
                                          nb_switches / 2, switches);
             }