commit 462a1997e9a6445e2dc60967c94093850815641d
parent 810632d6665dc5b45a564a3c7622fedf1f00f75e
Author: Chris Allegretta <chrisa@asty.org>
Date: Fri, 27 Oct 2000 05:33:18 +0000
Remove redundant code in do_replace()
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
M | po/nano.pot | | | 17 | ++++++++--------- |
M | search.c | | | 74 | ++++++++++++++++++++++++-------------------------------------------------- |
2 files changed, 32 insertions(+), 59 deletions(-)
diff --git 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-27 00:34-0400\n"
+"POT-Creation-Date: 2000-10-27 01:32-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -774,7 +774,7 @@ msgstr ""
msgid "Replaced 1 occurence"
msgstr ""
-#: search.c:392 search.c:421 search.c:449
+#: search.c:392 search.c:424
msgid "Replace Cancelled"
msgstr ""
@@ -789,29 +789,28 @@ msgstr ""
msgid "Replace with [%s]"
msgstr ""
-#. last_search is empty
-#: search.c:447
+#: search.c:419
msgid "Replace with"
msgstr ""
-#: search.c:493
+#: search.c:467
msgid "Replace this instance?"
msgstr ""
#. Ask for it
-#: search.c:554
+#: search.c:528
msgid "Enter line number"
msgstr ""
-#: search.c:556
+#: search.c:530
msgid "Aborted"
msgstr ""
-#: search.c:576
+#: search.c:550
msgid "Come on, be reasonable"
msgstr ""
-#: search.c:581
+#: search.c:555
#, c-format
msgid "Only %d lines available, skipping to last line"
msgstr ""
diff --git a/search.c b/search.c
@@ -412,64 +412,38 @@ int do_replace(void)
}
strncpy(prevanswer, answer, 132);
- if (strcmp(last_replace, "")) { /* There's a previous replace str */
+ if (strcmp(last_replace, "")) /* There's a previous replace str */
i = statusq(replace_list, REPLACE_LIST_LEN, "",
_("Replace with [%s]"), last_replace);
+ else
+ i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
- if (i == -1) { /* Aborted enter */
+ if (i == -1) { /* Aborted enter */
+ if (strcmp(last_replace, ""))
strncpy(answer, last_replace, 132);
- statusbar(_("Replace Cancelled"));
- replace_abort();
- return 0;
- } else if (i == 0) /* They actually entered something */
- strncpy(last_replace, answer, 132);
- else if (i == NANO_NULL_KEY) /* They actually entered something */
- strcpy(last_replace, "");
- else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
- if (ISSET(CASE_SENSITIVE))
- UNSET(CASE_SENSITIVE);
- else
- SET(CASE_SENSITIVE);
-
- do_replace();
- return 0;
- } else if (i == NANO_FROMSEARCHTOGOTO_KEY) { /* oops... */
- do_gotoline_void();
- return 0;
- } else if (i != -2) { /* First page, last page, for example could get here */
-
- do_early_abort();
- replace_abort();
- return 0;
- }
- } else { /* last_search is empty */
-
- i = statusq(replace_list, REPLACE_LIST_LEN, "", _("Replace with"));
- if (i == -1) {
- statusbar(_("Replace Cancelled"));
- replace_abort();
- return 0;
- } else if (i == 0) /* They entered something new */
- strncpy(last_replace, answer, 132);
- else if (i == NANO_CASE_KEY) { /* They want it case sensitive */
- if (ISSET(CASE_SENSITIVE))
- UNSET(CASE_SENSITIVE);
- else
- SET(CASE_SENSITIVE);
-
- do_replace();
- return -1;
- } else if (i == NANO_FROMSEARCHTOGOTO_KEY) { /* oops... */
- do_gotoline_void();
- return 0;
- } else if (i == NANO_NULL_KEY)
- strcpy(last_replace, "");
- else { /* First line key, etc. */
+ statusbar(_("Replace Cancelled"));
+ replace_abort();
+ return 0;
+ } else if (i == 0) /* They actually entered something */
+ strncpy(last_replace, answer, 132);
+ else if (i == NANO_NULL_KEY) /* They actually entered something */
+ strcpy(last_replace, "");
+ else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
+ if (ISSET(CASE_SENSITIVE))
+ UNSET(CASE_SENSITIVE);
+ else
+ SET(CASE_SENSITIVE);
+ do_replace();
+ return 0;
+ } else if (i == NANO_FROMSEARCHTOGOTO_KEY) { /* oops... */
+ do_gotoline_void();
+ return 0;
+ } else if (i != -2) { /* First page, last page, for example
+ could get here */
do_early_abort();
replace_abort();
return 0;
- }
}
/* save where we are */