Remove redundant code in do_replace()

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@246 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2000-10-27 05:33:18 +00:00
parent 810632d666
commit 462a1997e9
2 changed files with 32 additions and 59 deletions

View File

@ -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 ""

View File

@ -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);
if (i == -1) { /* Aborted enter */
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 */
else
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. */
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;
}
}
/* save where we are */