Re-wraping with partial end of line at start of save buffer

Joe Peterson joe at
Wed Sep 30 23:01:09 CEST 2015

Hi all,

I discovered a bit of unclean behavior today while listing a large
number of files that were too wide for my terminal window (each line
wrapped to the next line as expected).

In the problem case, the very top line of the save buffer contained
the wrapped end of the top line rather than the start of a line, which
has a 50/50 change of happening (depending on save buffer size and
window height).

Seeing the end remnant of the first line was somewhat expected when
the lines wrapped, but the real issue showed up when I made the
terminal window wider to allow the lines to re-wrap (unwrap in this
case). That end remnant of the first line in the save buffer remained,
so scrolling back to the top showed something like:

Normal line...............#2
Normal line...............#3
Normal line...............#4

In other words, the re-wrap code treated that first end-remnant of a
line as a regular full line, even though it was the end of a line.

I believe the correct behavior would be to throw away any partial line
(that is missing its beginning) at the top of the save buffer when
doing the re-wrap. It would be better to lose this line off the top
than to keep its end-remnant. Another solution would be simply to not
save partial lines in the save buffer at all (this might be even more

I have just started looking at the code, and I am glad to make a patch
once I comprehend what it is doing, but perhaps one of you knows how
to fix this off the bat.

Thanks, Joe

More information about the rxvt-unicode mailing list