nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 437cb410e945204de70e39e4bf5afd0aa750ea5f
parent 94e563232eec0d4f096fcbc2c00529eeccad1a51
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Thu, 26 Jan 2017 21:25:15 +0100

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.

Diffstat:
Msrc/search.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/search.c b/src/search.c @@ -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))