Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
c7eecd74
Commit
c7eecd74
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
new feature: a bindable function that starts always a backward search
parent
a7fa1744
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
doc/nano.texi
+5
-2
doc/nano.texi
doc/nanorc.5
+5
-2
doc/nanorc.5
src/global.c
+8
-1
src/global.c
src/proto.h
+2
-0
src/proto.h
src/search.c
+14
-0
src/search.c
with
34 additions
and
5 deletions
+34
-5
doc/nano.texi
View file @
c7eecd74
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
doc/nanorc.5
View file @
c7eecd74
...
...
@@ -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.
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
c7eecd74
...
...
@@ -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
;
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
c7eecd74
...
...
@@ -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
);
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
c7eecd74
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help