From a9b862c8046b13805b7d0e7cfaed788a8b2fc406 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 16 Aug 2005 01:27:05 +0000
Subject: [PATCH] fix more edit_scroll() breakage

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2994 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 src/move.c  | 2 +-
 src/winio.c | 9 +++++----
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/move.c b/src/move.c
index b982f222..e2953c1d 100644
--- a/src/move.c
+++ b/src/move.c
@@ -52,7 +52,7 @@ void do_last_line(void)
     openfile->current = openfile->filebot;
     openfile->current_x = 0;
     openfile->placewewant = 0;
-    openfile->current_y = editwinrows / 2;
+    openfile->current_y = editwinrows - 1;
 
     edit_redraw(current_save, pww_save);
 }
diff --git a/src/winio.c b/src/winio.c
index 119e5504..4132a190 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3560,11 +3560,12 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
     /* Part 2: nlines is the number of lines in the scrolled region of
      * the edit window that we need to draw. */
 
-    /* If we scrolled up, we couldn't scroll up all nlines lines, and
-     * we're now at the top of the file, we need to draw the entire edit
+    /* If we couldn't scroll up or down all nlines lines, and we're now
+     * at the top or bottom of the file, we need to draw the entire edit
      * window. */
-    if (direction == UP && i > 0 && openfile->edittop ==
-	openfile->fileage)
+    if (i > 0 && ((direction == UP && openfile->edittop ==
+	openfile->fileage) || (direction == DOWN && openfile->current ==
+	openfile->filebot)))
 	nlines = editwinrows;
 
     /* If the scrolled region contains only one line, and the line
-- 
GitLab