findnextstr() - Fixed check for string that only occurs on the same line failing


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@189 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
diff --git a/search.c b/search.c
index 8667e21..32fdd46 100644
--- a/search.c
+++ b/search.c
@@ -131,7 +131,7 @@
     char *searchstr, *found = NULL, *tmp;
     int past_editbot = 0;
 
-    fileptr = current;
+    fileptr = begin;
 
     searchstr = &current->data[current_x + 1];
     /* Look for searchstr until EOF */
@@ -165,17 +165,17 @@
 
 	fileptr = fileage;
 
-	while (fileptr != current && fileptr != begin &&
+	while (fileptr != begin->next &&
 	       (found = strstrwrapper(fileptr->data, needle)) == NULL)
 	    fileptr = fileptr->next;
 
-	if (fileptr == begin) {
+	if (fileptr == begin->next) {
 	    if (!quiet)
 		statusbar(_("\"%s\" not found"), needle);
 
 	    return NULL;
 	}
-	if (fileptr != current) {	/* We found something */
+	else {	/* We found something */
 	    current = fileptr;
 	    current_x = 0;
 	    for (tmp = fileptr->data; tmp != found; tmp++)
@@ -186,12 +186,7 @@
 
 	    if (!quiet)
 		statusbar(_("Search Wrapped"));
-	} else {		/* Nada */
-
-	    if (!quiet)
-		statusbar(_("\"%s\" not found"), needle);
-	    return NULL;
-	}
+	} 
     }
 
     return fileptr;