tweaks: only compensate for a partially-offscreen line in softwrap mode

A line can only be partially offscreen when doing softwrapping.
This commit is contained in:
David Lawrence Ramsey 2017-07-19 22:14:21 -05:00 committed by Benno Schulenberg
parent a1fba43452
commit ee8681d7cc

View File

@ -2949,12 +2949,14 @@ void edit_scroll(scroll_dir direction, int nrows)
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
#ifndef NANO_TINY
/* Compensate for the earlier chunks of a softwrapped line. */
nrows += chunk_for(leftedge, line);
if (ISSET(SOFTWRAP)) {
/* Compensate for the earlier chunks of a softwrapped line. */
nrows += chunk_for(leftedge, line);
/* Don't compensate for the chunks that are offscreen. */
if (line == openfile->edittop)
nrows -= chunk_for(openfile->firstcolumn, line);
/* Don't compensate for the chunks that are offscreen. */
if (line == openfile->edittop)
nrows -= chunk_for(openfile->firstcolumn, line);
}
#endif
/* Draw new content on the blank rows inside the scrolled region