diff --git a/ChangeLog b/ChangeLog index 19ea27e5..75d2ed48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ 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. + * src/search.c (search_init_globals): Elide this tiny function. 2015-04-20 Benno Schulenberg * src/winio.c (need_horizontal_update, need_vertical_update): Fuse diff --git a/src/proto.h b/src/proto.h index 823386a7..37aa1d31 100644 --- a/src/proto.h +++ b/src/proto.h @@ -579,7 +579,6 @@ void regexp_cleanup(void); #endif void not_found_msg(const char *str); void search_replace_abort(void); -void search_init_globals(void); int search_init(bool replacing, bool use_answer); bool findnextstr( #ifndef DISABLE_SPELLER diff --git a/src/search.c b/src/search.c index 923206ae..0a373174 100644 --- a/src/search.c +++ b/src/search.c @@ -116,12 +116,6 @@ void search_replace_abort(void) #endif } -/* Initialize the global search and replace strings. */ -void search_init_globals(void) -{ - focusing = TRUE; -} - /* Set up the system variables for a search or replace. If use_answer * is TRUE, only set backupstring to answer. Return -2 to run the * opposite program (search -> replace, replace -> search), return -1 if @@ -153,7 +147,7 @@ int search_init(bool replacing, bool use_answer) * do_search() or do_replace() and be called again. In that case, * we should put the same search string back up. */ - search_init_globals(); + focusing = TRUE; if (last_search[0] != '\0') { char *disp = display_string(last_search, 0, COLS / 3, FALSE); @@ -496,7 +490,7 @@ void do_research(void) size_t pww_save = openfile->placewewant; bool didfind; - search_init_globals(); + focusing = TRUE; if (last_search[0] != '\0') { #ifdef HAVE_REGEX_H diff --git a/src/text.c b/src/text.c index 31f3ed17..583c8ccd 100644 --- a/src/text.c +++ b/src/text.c @@ -2356,7 +2356,6 @@ bool do_int_spell_fix(const char *word) #endif /* Save the current search/replace strings. */ - search_init_globals(); save_search = last_search; save_replace = last_replace; @@ -2364,6 +2363,8 @@ bool do_int_spell_fix(const char *word) last_search = mallocstrcpy(NULL, word); last_replace = mallocstrcpy(NULL, word); + focusing = TRUE; + #ifndef NANO_TINY if (old_mark_set) { /* If the mark is on, partition the filestruct so that it