From a966d991e68ddc2a2c7274142ad1ee8c0f1b7f91 Mon Sep 17 00:00:00 2001
From: Adam Rogoyski <rogoyski@cs.utexas.edu>
Date: Sun, 9 Jul 2000 18:42:53 +0000
Subject: [PATCH] - findnextstr() off by one with past_editbot.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@97 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
---
 search.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/search.c b/search.c
index a14cb60c..41dcfdb5 100644
--- a/search.c
+++ b/search.c
@@ -136,11 +136,11 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
     /* Look for searchstr until EOF */
     while (fileptr != NULL &&
 	   (found = strstrwrapper(searchstr, needle)) == NULL) {
-	if (!past_editbot && (fileptr == editbot))
-	    past_editbot = 1;
 
 	fileptr = fileptr->next;
 
+	if (!past_editbot && (fileptr == editbot))
+	    past_editbot = 1;
 
 	if (fileptr == begin)
 	    return NULL;
@@ -179,8 +179,7 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle)
 	    for (tmp = fileptr->data; tmp != found; tmp++)
 		current_x++;
 
-	    if (past_editbot)
-		edit_update(current);
+	    edit_update(current);
 	    reset_cursor();
 
 	    if (!quiet)
-- 
GitLab