From 9babaf3b3804a1125ee9f23c7180f00a6de26025 Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Wed, 30 Aug 2000 13:49:33 +0000 Subject: [PATCH] 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 --- ChangeLog | 2 ++ po/nano.pot | 24 ++++++++++++------------ search.c | 15 +++++---------- 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/ChangeLog b/ChangeLog index b71f84df..780de0be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -18,6 +18,8 @@ CVS Code ugliness bug (reported by Ken Tyler). findnextstr(): - Added reset for placewewant (Ben Roberts). + - Fixed check for string that only occurs on the same line failing + (discovered by Ken Tyler). nano-0.9.16 - 08/09/2000 - cut.c: diff --git a/po/nano.pot b/po/nano.pot index cac23d46..70b40503 100644 --- a/po/nano.pot +++ b/po/nano.pot @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" -"POT-Creation-Date: 2000-08-28 23:58-0400\n" +"POT-Creation-Date: 2000-08-30 09:55-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -32,7 +32,7 @@ msgstr "" msgid "Read %d lines" msgstr "" -#: files.c:217 search.c:174 search.c:192 +#: files.c:217 search.c:174 #, c-format msgid "\"%s\" not found" msgstr "" @@ -691,47 +691,47 @@ msgstr "" msgid "Search Wrapped" msgstr "" -#: search.c:244 +#: search.c:239 #, c-format msgid "Replaced %d occurences" msgstr "" -#: search.c:246 +#: search.c:241 msgid "Replaced 1 occurence" msgstr "" -#: search.c:381 search.c:402 search.c:425 +#: search.c:376 search.c:397 search.c:420 msgid "Replace Cancelled" msgstr "" -#: search.c:398 +#: search.c:393 #, c-format msgid "Replace with [%s]" msgstr "" #. last_search is empty -#: search.c:423 +#: search.c:418 msgid "Replace with" msgstr "" -#: search.c:464 +#: search.c:459 msgid "Replace this instance?" msgstr "" #. Ask for it -#: search.c:515 +#: search.c:510 msgid "Enter line number" msgstr "" -#: search.c:517 +#: search.c:512 msgid "Aborted" msgstr "" -#: search.c:537 +#: search.c:532 msgid "Come on, be reasonable" msgstr "" -#: search.c:542 +#: search.c:537 #, c-format msgid "Only %d lines available, skipping to last line" msgstr "" diff --git a/search.c b/search.c index 8667e219..32fdd468 100644 --- a/search.c +++ b/search.c @@ -131,7 +131,7 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle) char *searchstr, *found = NULL, *tmp; int past_editbot = 0; - fileptr = current; + fileptr = begin; searchstr = ¤t->data[current_x + 1]; /* Look for searchstr until EOF */ @@ -165,17 +165,17 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle) 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 @@ filestruct *findnextstr(int quiet, filestruct * begin, char *needle) if (!quiet) statusbar(_("Search Wrapped")); - } else { /* Nada */ - - if (!quiet) - statusbar(_("\"%s\" not found"), needle); - return NULL; - } + } } return fileptr; -- 2.39.5