nano

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

commit 4ed359170348f14b7468f318766611b03d991df9
parent 3534d8ff25c6a6a6504d9d25c292ca2cb25a3782
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Wed, 25 Jan 2017 11:56:29 +0100

replacing: don't go outside of the selected region

When the tail of a match falls outside of the marked region,
it is in fact not a match and should not be replaced.

This fixes https://savannah.gnu.org/bugs/?50136.

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

diff --git a/src/search.c b/src/search.c @@ -643,7 +643,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only, * stop the fanfare. */ if (openfile->current->lineno > bot->lineno || openfile->current->lineno < top->lineno || - (openfile->current == bot && openfile->current_x > bot_x) || + (openfile->current == bot && openfile->current_x + match_len > bot_x) || (openfile->current == top && openfile->current_x < top_x)) break; }