display: limit an optimization to non-softwrap mode

Not drawing a line on a row if we're on the top row and scrolled down,
or if we're on the bottom row and scrolled up, will only work properly
if the line on that row takes up only that row.  The latter might not
be the case in softwrap mode: if the line occupies multiple chunks and
begins on that row -- in that case none of the chunks would be drawn.
master
David Lawrence Ramsey 2017-01-19 01:28:16 -06:00 committed by Benno Schulenberg
parent eb369c0e00
commit fa025f0ca3
1 changed files with 7 additions and 5 deletions

View File

@ -2929,12 +2929,14 @@ void edit_scroll(scroll_dir direction, int nrows)
}
/* Draw new lines on any blank rows before or inside the scrolled region.
* If we scrolled down and we're on the top row, or if we scrolled up and
* we're on the bottom row, the row won't be blank, so we don't need to
* draw it unless the mark is on or we're not on the first "page". */
* If we're not in softwrap mode, we can optimize one case: if we scrolled
* forward and we're on the top row, or if we scrolled backward and we're
* on the bottom row, the row won't be blank, so we don't need to draw it
* unless the mark is on or we're not on the first "page". */
for (i = nrows; i > 0 && line != NULL; i--) {
if ((i == nrows && direction == DOWNWARD) ||
(i == 1 && direction == UPWARD)) {
if (!ISSET(SOFTWRAP) &&
((i == 1 && direction == UPWARD) ||
(i == nrows && direction == DOWNWARD))) {
if (line_needs_update(openfile->placewewant, 0))
update_line(line, (line == openfile->current) ?
openfile->current_x : 0);