diff --git a/src/proto.h b/src/proto.h index 3f2ada7a..20c1fb17 100644 --- a/src/proto.h +++ b/src/proto.h @@ -478,18 +478,18 @@ void do_rcfiles(void); #endif /* ENABLE_NANORC */ /* Most functions in search.c. */ -void not_found_msg(const char *str); void tidy_up_after_search(void); int findnextstr(const char *needle, bool whole_word_only, int modus, size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x); void do_search(void); void do_search_forward(void); void do_search_backward(void); +void do_research(void); #ifndef NANO_TINY void do_findprevious(void); void do_findnext(void); #endif -void do_research(void); +void not_found_msg(const char *str); void go_looking(void); ssize_t do_replace_loop(const char *needle, bool whole_word_only, const filestruct *real_current, size_t *real_current_x); diff --git a/src/search.c b/src/search.c index 5edeb022..37236f19 100644 --- a/src/search.c +++ b/src/search.c @@ -55,17 +55,6 @@ bool regexp_init(const char *regexp) return TRUE; } -/* Report on the status bar that the given string was not found. */ -void not_found_msg(const char *str) -{ - char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE); - size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2)); - - statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp, - (disp[numchars] == '\0') ? "" : "..."); - free(disp); -} - /* Free a compiled regular expression, if one was compiled; and schedule a * full screen refresh when the mark is on, in case the cursor has moved. */ void tidy_up_after_search(void) @@ -354,22 +343,6 @@ void do_search_backward(void) do_search(); } -#ifndef NANO_TINY -/* Search in the backward direction for the next occurrence. */ -void do_findprevious(void) -{ - SET(BACKWARDS_SEARCH); - do_research(); -} - -/* Search in the forward direction for the next occurrence. */ -void do_findnext(void) -{ - UNSET(BACKWARDS_SEARCH); - do_research(); -} -#endif /* !NANO_TINY */ - /* Search for the last string without prompting. */ void do_research(void) { @@ -396,6 +369,33 @@ void do_research(void) tidy_up_after_search(); } +#ifndef NANO_TINY +/* Search in the backward direction for the next occurrence. */ +void do_findprevious(void) +{ + SET(BACKWARDS_SEARCH); + do_research(); +} + +/* Search in the forward direction for the next occurrence. */ +void do_findnext(void) +{ + UNSET(BACKWARDS_SEARCH); + do_research(); +} +#endif /* !NANO_TINY */ + +/* Report on the status bar that the given string was not found. */ +void not_found_msg(const char *str) +{ + char *disp = display_string(str, 0, (COLS / 2) + 1, FALSE); + size_t numchars = actual_x(disp, strnlenpt(disp, COLS / 2)); + + statusline(HUSH, _("\"%.*s%s\" not found"), numchars, disp, + (disp[numchars] == '\0') ? "" : "..."); + free(disp); +} + /* Search for the global string 'last_search'. Inform the user when * the string occurs only once. */ void go_looking(void)