From 86f8b3a1630ff7a7377d540489760515b938562b Mon Sep 17 00:00:00 2001 From: Chris Allegretta Date: Tue, 31 Oct 2000 05:28:33 +0000 Subject: [PATCH] Added checks for deleting search string when there was a previous value git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@251 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- po/nano.pot | 20 ++++++++++---------- search.c | 15 +++++++++++++++ 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/po/nano.pot b/po/nano.pot index 15fa3917..d47f580b 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-10-31 00:04-0500\n" +"POT-Creation-Date: 2000-10-31 00:28-0500\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -765,41 +765,41 @@ msgstr "" msgid "Search Wrapped" msgstr "" -#: search.c:258 +#: search.c:266 #, c-format msgid "Replaced %d occurences" msgstr "" -#: search.c:260 +#: search.c:268 msgid "Replaced 1 occurence" msgstr "" -#: search.c:396 search.c:427 +#: search.c:404 search.c:420 search.c:442 msgid "Replace Cancelled" msgstr "" -#: search.c:421 +#: search.c:436 msgid "Replace with" msgstr "" -#: search.c:461 +#: search.c:476 msgid "Replace this instance?" msgstr "" #. Ask for it -#: search.c:522 +#: search.c:537 msgid "Enter line number" msgstr "" -#: search.c:524 +#: search.c:539 msgid "Aborted" msgstr "" -#: search.c:544 +#: search.c:559 msgid "Come on, be reasonable" msgstr "" -#: search.c:549 +#: search.c:564 #, c-format msgid "Only %d lines available, skipping to last line" msgstr "" diff --git a/search.c b/search.c index c3b3c080..351155c3 100644 --- a/search.c +++ b/search.c @@ -246,6 +246,14 @@ int do_search(void) search_abort(); return 1; } + + /* The sneaky user deleted the previous search string */ + if (!strcmp(answer, "")) { + statusbar("Search Cancelled"); + search_abort(); + return 0; + } + search_last_line = 0; findnextstr(0, current, current_x, answer); search_abort(); @@ -407,6 +415,13 @@ int do_replace(void) return 0; } + /* Again, there was a previous string but they deleted it and hit enter */ + if (!strcmp(answer, "")) { + statusbar(_("Replace Cancelled")); + replace_abort(); + return 0; + } + strncpy(prevanswer, answer, 132); /* -- 2.39.5