scrolling: first move the cursor before pushing current chunk offscreen

When the cursor is on the first or last row of the edit window, and
thus Scroll-Down or Scroll-Up would push it offscreen, first move
the cursor away from the edge row and then scroll.

This fixes https://savannah.gnu.org/bugs/?53376.
This commit is contained in:
Benno Schulenberg 2018-03-18 15:58:46 +01:00
parent 7b1f3f4fe7
commit 373e3b880f
1 changed files with 7 additions and 5 deletions

View File

@ -529,20 +529,22 @@ void do_scroll_up(void)
if (openfile->edittop->prev == NULL && openfile->firstcolumn == 0)
return;
edit_scroll(BACKWARD);
if (openfile->current_y == editwinrows - 1)
do_up();
edit_scroll(BACKWARD);
}
/* Scroll down one line or chunk without scrolling the cursor. */
void do_scroll_down(void)
{
if (openfile->current->next != NULL || openfile->current_y > 0)
edit_scroll(FORWARD);
if (openfile->current_y == 0)
do_down();
if (openfile->edittop->next != NULL ||
chunk_for(openfile->firstcolumn, openfile->edittop) <
number_of_chunks_in(openfile->edittop))
edit_scroll(FORWARD);
}
#endif