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
5c3d5297
Commit
5c3d5297
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename a variable and condense an if
parent
8f10e364
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/search.c
+14
-15
src/search.c
with
14 additions
and
15 deletions
+14
-15
src/search.c
View file @
5c3d5297
...
...
@@ -580,7 +580,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
bool
replaceall
=
FALSE
;
bool
skipone
=
FALSE
;
#ifndef NANO_TINY
bool
old_
mark_set
=
openfile
->
mark_set
;
bool
mark
_was
_set
=
openfile
->
mark_set
;
filestruct
*
top
,
*
bot
;
size_t
top_x
,
bot_x
;
bool
right_side_up
=
FALSE
;
...
...
@@ -588,7 +588,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
* FALSE if (current, current_x) is. */
/* If the mark is on, frame the region, and turn the mark off. */
if
(
old_
mark_set
)
{
if
(
mark
_was
_set
)
{
mark_order
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
,
&
right_side_up
);
openfile
->
mark_set
=
FALSE
;
...
...
@@ -608,7 +608,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
while
(
TRUE
)
{
int
i
=
0
;
int
result
=
findnextstr
(
needle
,
whole_word_only
,
old_
mark_set
,
int
result
=
findnextstr
(
needle
,
whole_word_only
,
mark
_was
_set
,
&
match_len
,
skipone
,
real_current
,
*
real_current_x
);
/* If nothing more was found, or the user aborted, stop looping. */
...
...
@@ -619,15 +619,14 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
}
#ifndef NANO_TINY
if
(
old_mark_set
)
{
/* When we've found an occurrence outside of the marked region,
* stop the fanfare. */
if
(
openfile
->
current
->
lineno
>
bot
->
lineno
||
openfile
->
current
->
lineno
<
top
->
lineno
||
(
openfile
->
current
==
bot
&&
openfile
->
current_x
+
match_len
>
bot_x
)
||
(
openfile
->
current
==
top
&&
openfile
->
current_x
<
top_x
))
break
;
}
/* An occurrence outside of the marked region means we're done. */
if
(
mark_was_set
&&
(
openfile
->
current
->
lineno
>
bot
->
lineno
||
openfile
->
current
->
lineno
<
top
->
lineno
||
(
openfile
->
current
==
bot
&&
openfile
->
current_x
+
match_len
>
bot_x
)
||
(
openfile
->
current
==
top
&&
openfile
->
current_x
<
top_x
)))
break
;
#endif
/* Indicate that we found the search string. */
...
...
@@ -679,7 +678,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
#ifndef NANO_TINY
/* If the mark was on and it was located after the cursor,
* then adjust its x position for any text length changes. */
if
(
old_
mark_set
&&
!
right_side_up
)
{
if
(
mark
_was
_set
&&
!
right_side_up
)
{
if
(
openfile
->
current
==
openfile
->
mark_begin
&&
openfile
->
mark_begin_x
>
openfile
->
current_x
)
{
if
(
openfile
->
mark_begin_x
<
openfile
->
current_x
+
match_len
)
...
...
@@ -692,7 +691,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
/* If the mark was not on or it was before the cursor, then
* adjust the cursor's x position for any text length changes. */
if
(
!
old_
mark_set
||
right_side_up
)
{
if
(
!
mark
_was
_set
||
right_side_up
)
{
#endif
if
(
openfile
->
current
==
real_current
&&
openfile
->
current_x
<
*
real_current_x
)
{
...
...
@@ -748,7 +747,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
not_found_msg
(
needle
);
#ifndef NANO_TINY
if
(
old_
mark_set
)
if
(
mark
_was
_set
)
openfile
->
mark_set
=
TRUE
;
#endif
...
...
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