Finding each zero-length match only once, when doing regex replacements.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5319 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Benno Schulenberg
2015-07-26 08:20:28 +00:00
parent ee7b095678
commit 8ffc33cd89
2 changed files with 10 additions and 0 deletions
+6
View File
@@ -757,6 +757,12 @@ ssize_t do_replace_loop(
#endif
}
#ifdef HAVE_REGEX_H
/* Don't find the same zero-length match again. */
if (match_len == 0)
match_len++;
#endif
/* Set the cursor at the last character of the replacement
* text, so searching will resume after the replacement
* text. Note that current_x might be set to (size_t)-1