Initializing the search and replace strings in a central place.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5212 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
583a30e971
commit
1cf22d4d4f
|
@ -5,6 +5,8 @@
|
||||||
it will also work for do_fileresearch().
|
it will also work for do_fileresearch().
|
||||||
* src/text.c (do_int_spell_fix): Save and restore the global flags
|
* src/text.c (do_int_spell_fix): Save and restore the global flags
|
||||||
in the same short and quick way as above.
|
in the same short and quick way as above.
|
||||||
|
* src/nano.c (main): Initialize the search and replace strings in
|
||||||
|
a central place, to get rid of a bunch of ifs.
|
||||||
|
|
||||||
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
|
2015-04-20 Benno Schulenberg <bensberg@justemail.net>
|
||||||
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
|
* src/winio.c (need_horizontal_update, need_vertical_update): Fuse
|
||||||
|
|
|
@ -706,9 +706,6 @@ int filesearch_init(void)
|
||||||
int input;
|
int input;
|
||||||
char *buf;
|
char *buf;
|
||||||
|
|
||||||
if (last_search == NULL)
|
|
||||||
last_search = mallocstrcpy(NULL, "");
|
|
||||||
|
|
||||||
if (last_search[0] != '\0') {
|
if (last_search[0] != '\0') {
|
||||||
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
char *disp = display_string(last_search, 0, COLS / 3, FALSE);
|
||||||
|
|
||||||
|
@ -844,9 +841,6 @@ void do_filesearch(void)
|
||||||
/* Search for the last given filename again without prompting. */
|
/* Search for the last given filename again without prompting. */
|
||||||
void do_fileresearch(void)
|
void do_fileresearch(void)
|
||||||
{
|
{
|
||||||
if (last_search == NULL)
|
|
||||||
last_search = mallocstrcpy(NULL, "");
|
|
||||||
|
|
||||||
if (last_search[0] == '\0')
|
if (last_search[0] == '\0')
|
||||||
statusbar(_("No current search pattern"));
|
statusbar(_("No current search pattern"));
|
||||||
else
|
else
|
||||||
|
|
|
@ -1602,10 +1602,8 @@ void thanks_for_all_the_fish(void)
|
||||||
if (full_operating_dir != NULL)
|
if (full_operating_dir != NULL)
|
||||||
free(full_operating_dir);
|
free(full_operating_dir);
|
||||||
#endif
|
#endif
|
||||||
if (last_search != NULL)
|
free(last_search);
|
||||||
free(last_search);
|
free(last_replace);
|
||||||
if (last_replace != NULL)
|
|
||||||
free(last_replace);
|
|
||||||
#ifndef DISABLE_SPELLER
|
#ifndef DISABLE_SPELLER
|
||||||
if (alt_speller != NULL)
|
if (alt_speller != NULL)
|
||||||
free(alt_speller);
|
free(alt_speller);
|
||||||
|
|
|
@ -2648,6 +2648,10 @@ int main(int argc, char **argv)
|
||||||
#endif /* !DISABLE_NANORC */
|
#endif /* !DISABLE_NANORC */
|
||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
|
/* Initialize the search and replace strings. */
|
||||||
|
last_search = mallocstrcpy(NULL, "");
|
||||||
|
last_replace = mallocstrcpy(NULL, "");
|
||||||
|
|
||||||
/* If tabsize wasn't specified, set its default value. */
|
/* If tabsize wasn't specified, set its default value. */
|
||||||
if (tabsize == -1)
|
if (tabsize == -1)
|
||||||
tabsize = WIDTH_OF_TAB;
|
tabsize = WIDTH_OF_TAB;
|
||||||
|
|
|
@ -120,10 +120,6 @@ void search_replace_abort(void)
|
||||||
void search_init_globals(void)
|
void search_init_globals(void)
|
||||||
{
|
{
|
||||||
focusing = TRUE;
|
focusing = TRUE;
|
||||||
if (last_search == NULL)
|
|
||||||
last_search = mallocstrcpy(NULL, "");
|
|
||||||
if (last_replace == NULL)
|
|
||||||
last_replace = mallocstrcpy(NULL, "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up the system variables for a search or replace. If use_answer
|
/* Set up the system variables for a search or replace. If use_answer
|
||||||
|
|
Loading…
Reference in New Issue