less: disable "suppress empty wraparound" optimization

It is buggy wrt another use case...

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2014-09-21 22:10:55 +02:00
parent fbdc167f27
commit 15943c886d

View File

@ -491,6 +491,11 @@ static void read_lines(void)
*p++ = c; *p++ = c;
*p = '\0'; *p = '\0';
} /* end of "read chars until we have a line" loop */ } /* 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 */ /* Corner case: linewrap with only "" wrapping to next line */
/* Looks ugly on screen, so we do not store this empty line */ /* Looks ugly on screen, so we do not store this empty line */
if (!last_terminated && !current_line[0]) { if (!last_terminated && !current_line[0]) {
@ -498,6 +503,7 @@ static void read_lines(void)
max_lineno++; max_lineno++;
continue; continue;
} }
#endif
reached_eof: reached_eof:
last_terminated = terminated; last_terminated = terminated;
flines = xrealloc_vector(flines, 8, max_fline); flines = xrealloc_vector(flines, 8, max_fline);