moving: /do/ redraw the prior line when the viewport hasn't changed

The complementary test on current_y should only be done when doing
a scroll-only, because only then the prior line can be offscreen.

This fixes https://savannah.gnu.org/bugs/?50658.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
master
Benno Schulenberg 2017-03-28 10:23:27 +02:00
parent 9cf980700c
commit bc876ca729
1 changed files with 4 additions and 2 deletions

View File

@ -489,11 +489,12 @@ void do_up(bool scroll_only)
1 : editwinrows / 2 + 1);
/* If the lines weren't already redrawn, see if they need to be. */
if (openfile->current_y > 0 && openfile->current_y < editwinrows - 1) {
if (openfile->current_y > 0) {
/* Redraw the prior line if it's not actually the same line as the
* current one (which it might be in softwrap mode, if we moved just
* one chunk) and the line was horizontally scrolled. */
if (openfile->current != was_current
&& (!scroll_only || openfile->current_y < editwinrows - 1)
&& line_needs_update(was_column, 0))
update_line(openfile->current->next, 0);
/* Redraw the current line if it needs to be horizontally scrolled. */
@ -545,11 +546,12 @@ void do_down(bool scroll_only)
1 : editwinrows / 2 + 1);
/* If the lines weren't already redrawn, see if they need to be. */
if (openfile->current_y > 0 && openfile->current_y < editwinrows - 1) {
if (openfile->current_y < editwinrows - 1) {
/* Redraw the prior line if it's not actually the same line as the
* current one (which it might be in softwrap mode, if we moved just
* one chunk) and the line was horizontally scrolled. */
if (openfile->current != was_current &&
(!scroll_only || openfile->current_y > 0) &&
line_needs_update(was_column, 0))
update_line(openfile->current->prev, 0);
/* Redraw the current line if it needs to be horizontally scrolled. */