mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 21:01:24 +03:00
new feature: a bindable function that starts always a backward search
This commit is contained in:
parent
a7fa174438
commit
c7eecd74de
@ -1087,8 +1087,11 @@ Inserts a file into the current buffer (at the current cursor position),
|
||||
or into a new buffer when option @code{multibuffer} is set.
|
||||
|
||||
@item whereis
|
||||
Searches for text in the current buffer --- or for filenames matching
|
||||
a string in the current list in the file browser
|
||||
Starts a forward search for text in the current buffer --- or for filenames
|
||||
matching a string in the current list in the file browser.
|
||||
|
||||
@item wherewas
|
||||
Starts a backward search for text in the current buffer.
|
||||
|
||||
@item searchagain
|
||||
Repeats the last search command without prompting.
|
||||
|
@ -443,8 +443,11 @@ Inserts a file into the current buffer (at the current cursor position),
|
||||
or into a new buffer when option \fBmultibuffer\fR is set.
|
||||
.TP
|
||||
.B whereis
|
||||
Searches for text in the current buffer -- or for filenames matching
|
||||
a string in the current list in the file browser.
|
||||
Starts a forward search for text in the current buffer -- or for filenames
|
||||
matching a string in the current list in the file browser.
|
||||
.TP
|
||||
.B wherewas
|
||||
Starts a backward search for text in the current buffer.
|
||||
.TP
|
||||
.B searchagain
|
||||
Repeats the last search command without prompting.
|
||||
|
@ -534,6 +534,8 @@ void shortcut_init(void)
|
||||
N_("Insert another file into the current one");
|
||||
const char *nano_whereis_msg =
|
||||
N_("Search for a string or a regular expression");
|
||||
const char *nano_wherewas_msg =
|
||||
N_("Search backward for a string or expression");
|
||||
#ifdef ENABLE_BROWSER
|
||||
const char *nano_browser_whereis_msg = N_("Search for a string");
|
||||
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
||||
@ -974,6 +976,9 @@ void shortcut_init(void)
|
||||
N_("Comment Lines"), IFSCHELP(nano_comment_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_search_backward, MMAIN,
|
||||
N_("Where Was"), IFSCHELP(N_(nano_wherewas_msg)), BLANKAFTER, VIEW);
|
||||
|
||||
add_to_funcs(do_savefile, MMAIN,
|
||||
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
|
||||
#endif
|
||||
@ -1462,7 +1467,9 @@ sc *strtosc(const char *input)
|
||||
else if (!strcasecmp(input, "insert"))
|
||||
s->scfunc = do_insertfile_void;
|
||||
else if (!strcasecmp(input, "whereis"))
|
||||
s->scfunc = do_search;
|
||||
s->scfunc = do_search_forward;
|
||||
else if (!strcasecmp(input, "wherewas"))
|
||||
s->scfunc = do_search_backward;
|
||||
else if (!strcasecmp(input, "searchagain") ||
|
||||
!strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */
|
||||
s->scfunc = do_research;
|
||||
|
@ -502,6 +502,8 @@ void search_replace_abort(void);
|
||||
int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
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);
|
||||
#ifndef NANO_TINY
|
||||
void do_findprevious(void);
|
||||
void do_findnext(void);
|
||||
|
14
src/search.c
14
src/search.c
@ -374,6 +374,20 @@ void do_search(void)
|
||||
go_looking();
|
||||
}
|
||||
|
||||
/* Search forward for a string. */
|
||||
void do_search_forward(void)
|
||||
{
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
do_search();
|
||||
}
|
||||
|
||||
/* Search backwards for a string. */
|
||||
void do_search_backward(void)
|
||||
{
|
||||
SET(BACKWARDS_SEARCH);
|
||||
do_search();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Search in the backward direction for the next occurrence. */
|
||||
void do_findprevious(void)
|
||||
|
Loading…
Reference in New Issue
Block a user