Commit 437cb410 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

replacing: detect when the whole region has already been covered

Even when a match falls within the marked region, this does not mean
that it is a true match when already the whole file has been searched,
because then this is the second time we find this match.

This fixes https://savannah.gnu.org/bugs/?50158.
No related merge requests found
Showing with 1 addition and 1 deletion
+1 -1
......@@ -623,7 +623,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
if (old_mark_set) {
/* When we've found an occurrence outside of the marked region,
* stop the fanfare. */
if (openfile->current->lineno > bot->lineno ||
if (came_full_circle || 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))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment