scrolling: don't overscroll when the edit window has just one row

If the edit window consists of a single row, then the do_down() call
has already brought the desired line or chunk into view -- no attempt
should then be made to scroll the screen further.

This fixes https://savannah.gnu.org/bugs/?56553.

Bug existed since version 2.9.6, commit 0d9080a2.
This commit is contained in:
Benno Schulenberg 2019-06-26 12:17:29 +02:00
parent 8cd6aa0a32
commit 5cfb74650d
1 changed files with 2 additions and 2 deletions

View File

@ -554,12 +554,12 @@ void do_scroll_down(void)
if (openfile->current_y == 0)
do_down();
if (openfile->edittop->next != NULL
if (editwinrows > 1 && (openfile->edittop->next != NULL
#ifndef NANO_TINY
|| chunk_for(openfile->firstcolumn, openfile->edittop) <
number_of_chunks_in(openfile->edittop)
#endif
)
))
edit_scroll(FORWARD);
}
#endif