Commit 462a1997 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

Remove redundant code in do_replace()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 32 additions and 59 deletions
+32 -59
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
...@@ -774,7 +774,7 @@ msgstr "" ...@@ -774,7 +774,7 @@ msgstr ""
msgid "Replaced 1 occurence" msgid "Replaced 1 occurence"
msgstr "" msgstr ""
#: search.c:392 search.c:421 search.c:449 #: search.c:392 search.c:424
msgid "Replace Cancelled" msgid "Replace Cancelled"
msgstr "" msgstr ""
...@@ -789,29 +789,28 @@ msgstr "" ...@@ -789,29 +789,28 @@ msgstr ""
msgid "Replace with [%s]" msgid "Replace with [%s]"
msgstr "" msgstr ""
#. last_search is empty #: search.c:419
#: search.c:447
msgid "Replace with" msgid "Replace with"
msgstr "" msgstr ""
#: search.c:493 #: search.c:467
msgid "Replace this instance?" msgid "Replace this instance?"
msgstr "" msgstr ""
#. Ask for it #. Ask for it
#: search.c:554 #: search.c:528
msgid "Enter line number" msgid "Enter line number"
msgstr "" msgstr ""
#: search.c:556 #: search.c:530
msgid "Aborted" msgid "Aborted"
msgstr "" msgstr ""
#: search.c:576 #: search.c:550
msgid "Come on, be reasonable" msgid "Come on, be reasonable"
msgstr "" msgstr ""
#: search.c:581 #: search.c:555
#, c-format #, c-format
msgid "Only %d lines available, skipping to last line" msgid "Only %d lines available, skipping to last line"
msgstr "" msgstr ""
......
...@@ -412,64 +412,38 @@ int do_replace(void) ...@@ -412,64 +412,38 @@ int do_replace(void)
} }
strncpy(prevanswer, answer, 132); 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, "", i = statusq(replace_list, REPLACE_LIST_LEN, "",
_("Replace with [%s]"), last_replace); _("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); strncpy(answer, last_replace, 132);
statusbar(_("Replace Cancelled")); statusbar(_("Replace Cancelled"));
replace_abort(); replace_abort();
return 0; return 0;
} else if (i == 0) /* They actually entered something */ } else if (i == 0) /* They actually entered something */
strncpy(last_replace, answer, 132); strncpy(last_replace, answer, 132);
else if (i == NANO_NULL_KEY) /* They actually entered something */ else if (i == NANO_NULL_KEY) /* They actually entered something */
strcpy(last_replace, ""); strcpy(last_replace, "");
else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */ else if (i == NANO_CASE_KEY) { /* They asked for case sensitivity */
if (ISSET(CASE_SENSITIVE)) if (ISSET(CASE_SENSITIVE))
UNSET(CASE_SENSITIVE); UNSET(CASE_SENSITIVE);
else else
SET(CASE_SENSITIVE); 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. */
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(); do_early_abort();
replace_abort(); replace_abort();
return 0; return 0;
}
} }
/* save where we are */ /* save where we are */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment