Skip to content
GitLab
Menu
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
e36e829a
Commit
e36e829a
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: set the length of a search match in a clearer manner
parent
121c53f3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/search.c
+5
-8
src/search.c
with
5 additions
and
8 deletions
+5
-8
src/search.c
View file @
e36e829a
...
...
@@ -234,8 +234,8 @@ int search_init(bool replacing, bool use_answer)
int
findnextstr
(
const
char
*
needle
,
bool
whole_word_only
,
size_t
*
match_len
,
const
filestruct
*
begin
,
size_t
begin_x
)
{
size_t
found_len
;
/* The length of
the
match
we find
. */
size_t
found_len
=
strlen
(
needle
)
;
/* The length of
a
match
-- will be recomputed for a regex
. */
int
feedback
=
0
;
/* When bigger than zero, show and wipe the "Searching..." message. */
filestruct
*
fileptr
=
openfile
->
current
;
...
...
@@ -290,14 +290,11 @@ int findnextstr(const char *needle, bool whole_word_only, size_t *match_len,
found
=
strstrwrapper
(
fileptr
->
data
,
needle
,
rev_start
);
if
(
found
!=
NULL
)
{
/* Remember the length of the potential match. */
found_len
=
#ifdef HAVE_REGEX_H
ISSET
(
USE_REGEXP
)
?
regmatches
[
0
].
rm_eo
-
regmatches
[
0
].
rm_so
:
/* When doing a regex search, compute the length of the match. */
if
(
ISSET
(
USE_REGEXP
))
found_len
=
regmatches
[
0
].
rm_eo
-
regmatches
[
0
].
rm_so
;
#endif
strlen
(
needle
);
#ifndef DISABLE_SPELLER
/* When we're spell checking, a match is only a true match when
* it is a separate word. */
...
...
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