From 0532296a101482b451df072e481b043d3dc6b915 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Thu, 14 Jul 2005 23:51:52 +0000
Subject: [PATCH] more miscellaneous minor fixes

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

diff --git a/ChangeLog b/ChangeLog
index f1ee5a93..403875f2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -96,8 +96,9 @@ CVS code -
   do_replace()
 	- Blank out last_replace properly again just before displaying
 	  the "Replace" prompt. (DLR, found by Mike Frysinger)
+	- Remove unnecessary renumber(). (DLR)
 - winio.c:
-  edit_scroll()
+  edit_scroll(), edit_refresh()
 	- Clean up and simplify. (DLR)
   do_statusbar_next_word()
 	- Rework to be more like do_statusbar_prev_word(), to avoid a
diff --git a/src/nano.c b/src/nano.c
index 770afe37..2d7338e8 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -191,7 +191,7 @@ void renumber(filestruct *fileptr)
     assert(fileptr != fileptr->next);
 
     for (; fileptr != NULL; fileptr = fileptr->next)
-	fileptr->lineno = line++;
+	fileptr->lineno = ++line;
 }
 
 /* Partition a filestruct so it begins at (top, top_x) and ends at (bot,
diff --git a/src/search.c b/src/search.c
index c169c18f..365a9f9b 100644
--- a/src/search.c
+++ b/src/search.c
@@ -956,7 +956,6 @@ void do_replace(void)
     openfile->current_x = begin_x;
     openfile->placewewant = pww_save;
 
-    renumber(openfile->fileage);
     edit_refresh();
 
     if (numreplaced >= 0)
diff --git a/src/winio.c b/src/winio.c
index 1d7a0b00..8a469adf 100644
--- a/src/winio.c
+++ b/src/winio.c
@@ -3624,13 +3624,11 @@ void edit_refresh(void)
 	fprintf(stderr, "edit_refresh(): edittop->lineno = %ld\n", (long)openfile->edittop->lineno);
 #endif
 
-	while (nlines < editwinrows) {
+	while (nlines < editwinrows && foo != NULL) {
 	    update_line(foo, (foo == openfile->current) ?
 		openfile->current_x : 0);
-	    nlines++;
-	    if (foo->next == NULL)
-		break;
 	    foo = foo->next;
+	    nlines++;
 	}
 	while (nlines < editwinrows) {
 	    blank_line(edit, nlines, 0, COLS);
-- 
GitLab