Commit 00c1105c authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

search: suppress the occurrence at the cursor only when replacing

When we're just searching, we do want to report the occurrence at
the cursor (after coming full circle) as a match, so that we can
mention that this is the only occurrence.  When replacing, we do
not want to replace this match twice.

This fixes https://savannah.gnu.org/bugs/?52888.
No related merge requests found
Showing with 2 additions and 1 deletion
+2 -1
......@@ -328,7 +328,8 @@ int findnextstr(const char *needle, bool whole_word_only, int modus,
enable_waiting();
/* Ensure that the found occurrence is not beyond the starting x. */
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && found_x >= begin_x) ||
if (came_full_circle && ((!ISSET(BACKWARDS_SEARCH) && (found_x > begin_x ||
(modus == REPLACING && found_x == begin_x))) ||
(ISSET(BACKWARDS_SEARCH) && found_x < begin_x)))
return 0;
......
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