new feature: a bindable function that starts always a backward search
Этот коммит содержится в:
родитель
a7fa174438
Коммит
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.
|
or into a new buffer when option @code{multibuffer} is set.
|
||||||
|
|
||||||
@item whereis
|
@item whereis
|
||||||
Searches for text in the current buffer --- or for filenames matching
|
Starts a forward search for text in the current buffer --- or for filenames
|
||||||
a string in the current list in the file browser
|
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
|
@item searchagain
|
||||||
Repeats the last search command without prompting.
|
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.
|
or into a new buffer when option \fBmultibuffer\fR is set.
|
||||||
.TP
|
.TP
|
||||||
.B whereis
|
.B whereis
|
||||||
Searches for text in the current buffer -- or for filenames matching
|
Starts a forward search for text in the current buffer -- or for filenames
|
||||||
a string in the current list in the file browser.
|
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
|
.TP
|
||||||
.B searchagain
|
.B searchagain
|
||||||
Repeats the last search command without prompting.
|
Repeats the last search command without prompting.
|
||||||
|
@ -534,6 +534,8 @@ void shortcut_init(void)
|
|||||||
N_("Insert another file into the current one");
|
N_("Insert another file into the current one");
|
||||||
const char *nano_whereis_msg =
|
const char *nano_whereis_msg =
|
||||||
N_("Search for a string or a regular expression");
|
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
|
#ifdef ENABLE_BROWSER
|
||||||
const char *nano_browser_whereis_msg = N_("Search for a string");
|
const char *nano_browser_whereis_msg = N_("Search for a string");
|
||||||
const char *nano_browser_refresh_msg = N_("Refresh the file list");
|
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);
|
N_("Comment Lines"), IFSCHELP(nano_comment_msg), BLANKAFTER, NOVIEW);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_TINY
|
#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,
|
add_to_funcs(do_savefile, MMAIN,
|
||||||
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
|
N_("Save"), IFSCHELP(nano_savefile_msg), BLANKAFTER, NOVIEW);
|
||||||
#endif
|
#endif
|
||||||
@ -1462,7 +1467,9 @@ sc *strtosc(const char *input)
|
|||||||
else if (!strcasecmp(input, "insert"))
|
else if (!strcasecmp(input, "insert"))
|
||||||
s->scfunc = do_insertfile_void;
|
s->scfunc = do_insertfile_void;
|
||||||
else if (!strcasecmp(input, "whereis"))
|
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") ||
|
else if (!strcasecmp(input, "searchagain") ||
|
||||||
!strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */
|
!strcasecmp(input, "research")) /* Deprecated. Remove in 2018. */
|
||||||
s->scfunc = do_research;
|
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,
|
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);
|
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
|
||||||
void do_search(void);
|
void do_search(void);
|
||||||
|
void do_search_forward(void);
|
||||||
|
void do_search_backward(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
void do_findprevious(void);
|
void do_findprevious(void);
|
||||||
void do_findnext(void);
|
void do_findnext(void);
|
||||||
|
14
src/search.c
14
src/search.c
@ -374,6 +374,20 @@ void do_search(void)
|
|||||||
go_looking();
|
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
|
#ifndef NANO_TINY
|
||||||
/* Search in the backward direction for the next occurrence. */
|
/* Search in the backward direction for the next occurrence. */
|
||||||
void do_findprevious(void)
|
void do_findprevious(void)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user