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
04013fb7
Commit
04013fb7
authored
9 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
search: untangle two lines and tweak two comments
parent
a101b30f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/search.c
+14
-10
src/search.c
with
14 additions
and
10 deletions
+14
-10
src/search.c
View file @
04013fb7
...
...
@@ -976,20 +976,24 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
* end of the line. This won't be a problem because we'll skip over
* it below in that case, and rev_start will be properly set when
* the search continues on the previous or next line. */
rev_start
=
reverse
?
fileptr
->
data
+
(
openfile
->
current_x
-
1
)
:
fileptr
->
data
+
(
openfile
->
current_x
+
1
);
if
(
reverse
)
rev_start
=
fileptr
->
data
+
(
openfile
->
current_x
-
1
);
else
rev_start
=
fileptr
->
data
+
(
openfile
->
current_x
+
1
);
/* Look for either of the two characters in bracket_set. rev_start
* can be 1 character before the start or after the end of the line.
* In either case, just act as though no match is found. */
while
(
TRUE
)
{
found
=
((
rev_start
>
fileptr
->
data
&&
*
(
rev_start
-
1
)
==
'\0'
)
||
rev_start
<
fileptr
->
data
)
?
NULL
:
(
reverse
?
mbrevstrpbrk
(
fileptr
->
data
,
bracket_set
,
rev_start
)
:
mbstrpbrk
(
rev_start
,
bracket_set
));
if
((
rev_start
>
fileptr
->
data
&&
*
(
rev_start
-
1
)
==
'\0'
)
||
rev_start
<
fileptr
->
data
)
found
=
NULL
;
else
if
(
reverse
)
found
=
mbrevstrpbrk
(
fileptr
->
data
,
bracket_set
,
rev_start
);
else
found
=
mbstrpbrk
(
rev_start
,
bracket_set
);
if
(
found
!=
NULL
)
/* We've found a potential match. */
if
(
found
)
break
;
if
(
reverse
)
...
...
@@ -997,8 +1001,8 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
else
fileptr
=
fileptr
->
next
;
/* If we've reached the start or end of the buffer, get out. */
if
(
fileptr
==
NULL
)
/* We've reached the start or end of the buffer, so get out. */
return
FALSE
;
rev_start
=
fileptr
->
data
;
...
...
@@ -1006,7 +1010,7 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
rev_start
+=
strlen
(
fileptr
->
data
);
}
/*
We've definitely found something
. */
/*
Set the current position to the found matching bracket
. */
openfile
->
current
=
fileptr
;
openfile
->
current_x
=
found
-
fileptr
->
data
;
openfile
->
current_y
=
fileptr
->
lineno
-
openfile
->
edittop
->
lineno
;
...
...
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