less: disable "suppress empty wraparound" optimization
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 21 Sep 2014 20:10:55 +0000 (22:10 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 21 Sep 2014 20:10:55 +0000 (22:10 +0200)
It is buggy wrt another use case...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
miscutils/less.c

index d84df469c008892c12a39e7b5ab9176f977d3656..719af5a0dfe0d0e903381475d8c5225d3eac02a9 100644 (file)
@@ -491,6 +491,11 @@ static void read_lines(void)
                        *p++ = c;
                        *p = '\0';
                } /* end of "read chars until we have a line" loop */
+#if 0
+//BUG: also triggers on this:
+// { printf "\nfoo\n"; sleep 1; printf "\nbar\n"; } | less
+// (resulting in lost empty line between "foo" and "bar" lines)
+// the "terminated" logic needs fixing (or explaining)
                /* Corner case: linewrap with only "" wrapping to next line */
                /* Looks ugly on screen, so we do not store this empty line */
                if (!last_terminated && !current_line[0]) {
@@ -498,6 +503,7 @@ static void read_lines(void)
                        max_lineno++;
                        continue;
                }
+#endif
  reached_eof:
                last_terminated = terminated;
                flines = xrealloc_vector(flines, 8, max_fline);