Commit 373e3b88 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 7 additions and 5 deletions
+7 -5
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment