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.master
parent
6a4d88cb4c
commit
00c1105c1b
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue