From ce1d7652f330bf54446740b0a43b5ae44cd57bb7 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Tue, 1 Jun 2004 18:32:36 +0000
Subject: [PATCH] edit_redraw() should update when we're not on the first page
 and/or when we're not on the same page as before, not just in the former case

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

diff --git a/ChangeLog b/ChangeLog
index 289bc6c1..fc5976c3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -90,7 +90,8 @@ CVS code -
 	  do_right_void(), need_horizontal_update(),
 	  need_vertical_update(), edit_scroll(), and edit_redraw().  All
 	  of these functions but the first two require the previous
-	  versions of current and/or placewewant as parameters.  Also
+	  versions of current and/or placewewant as parameters, so that
+	  they can redraw properly when the location has changed.  Also
 	  rename the int refresh in do_delete() and do_backspace() to
 	  do_refresh so as not to conflict with refresh(). (DLR)
 	- Add some comments better explaining what is disabled in
diff --git a/src/winio.c b/src/winio.c
index a82facb2..6e0c3a23 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -2610,7 +2610,8 @@ void edit_scroll(updown direction, int nlines)
  * updated. */
 void edit_redraw(const filestruct *old_current, int old_pww)
 {
-    int do_refresh = need_vertical_update(old_pww);
+    int do_refresh = need_vertical_update(0) ||
+	need_vertical_update(old_pww);
     const filestruct *foo;
 
     /* If either old_current or current is offscreen, refresh the screen
@@ -2623,9 +2624,9 @@ void edit_redraw(const filestruct *old_current, int old_pww)
 	return;
     }
 
-    /* Update old_current and current if we're not on the first page.
-     * If the mark is on, update all the lines between old_current and
-     * current too. */
+    /* Update old_current and current if we're not on the first page
+     * and/or we're not on the same page as before.  If the mark is on,
+     * update all the lines between old_current and current too. */
     foo = old_current;
     while (foo != current) {
 	if (do_refresh)
-- 
GitLab