[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH] replacing: don't skip the first character of a back
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH] replacing: don't skip the first character of a backwards-marked region |
Date: |
Wed, 3 Jan 2018 11:14:07 +0100 |
Also, when replacing forwards, do not first skip the occurrence at the
cursor and then replace it at the end, but begin with it, as one would
expect.
This fixes https://savannah.gnu.org/bugs/?52789
and fixes https://savannah.gnu.org/bugs/?52791.
[ Any objections against this behavior change? ]
---
src/search.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/search.c b/src/search.c
index 88cd1ffe..04010266 100644
--- a/src/search.c
+++ b/src/search.c
@@ -256,7 +256,7 @@ int findnextstr(const char *needle, bool whole_word_only,
int modus,
/* Ignore the initial match at the starting position: continue
* searching from the next character, or invalidate the match.
*/
- if (skipone || (!whole_word_only && !came_full_circle &&
+ if (skipone || (came_full_circle && !ISSET(BACKWARDS_SEARCH) &&
found ==
begin->data + begin_x)) {
skipone = FALSE;
if (ISSET(BACKWARDS_SEARCH) && from != line->data) {
@@ -546,7 +546,7 @@ ssize_t do_replace_loop(const char *needle, bool
whole_word_only,
ssize_t numreplaced = -1;
size_t match_len;
bool replaceall = FALSE;
- bool skipone = FALSE;
+ bool skipone = ISSET(BACKWARDS_SEARCH);
int modus = REPLACING;
#ifndef NANO_TINY
filestruct *was_mark = openfile->mark;
--
2.14.3
- [Nano-devel] [PATCH] replacing: don't skip the first character of a backwards-marked region,
Benno Schulenberg <=