commit 373e3b880f01eb04950136f1055c6a79ada9a805
parent 7b1f3f4fe7c8cbfd3287365a712e2736b4cd27d2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 18 Mar 2018 15:58:46 +0100
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.
Diffstat:
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/move.c b/src/move.c
@@ -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