do the check for being outside the mark after the zero-length regexes
check, so that zero-length regex replaces work properly again git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2005 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Этот коммит содержится в:
родитель
9819ed031b
Коммит
3288925efb
34
src/search.c
34
src/search.c
@ -709,6 +709,23 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
|
#ifdef HAVE_REGEX_H
|
||||||
|
/* If the bol_or_eol flag is set, we've found a match on the
|
||||||
|
* beginning line already, and we're still on the beginning line
|
||||||
|
* after the search, it means that we've wrapped around, so
|
||||||
|
* we're done. */
|
||||||
|
if (bol_or_eol && begin_line && current == real_current)
|
||||||
|
break;
|
||||||
|
/* Otherwise, set the begin_line flag if we've found a match on
|
||||||
|
* the beginning line, reset the bol_or_eol flag, and
|
||||||
|
* continue. */
|
||||||
|
else {
|
||||||
|
if (current == real_current)
|
||||||
|
begin_line = TRUE;
|
||||||
|
bol_or_eol = FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_SMALL
|
||||||
/* If we've found a match outside the marked text, skip over it
|
/* If we've found a match outside the marked text, skip over it
|
||||||
* and search for another one. */
|
* and search for another one. */
|
||||||
@ -731,23 +748,6 @@ ssize_t do_replace_loop(const char *needle, filestruct *real_current,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
/* If the bol_or_eol flag is set, we've found a match on the
|
|
||||||
* beginning line already, and we're still on the beginning line
|
|
||||||
* after the search, it means that we've wrapped around, so
|
|
||||||
* we're done. */
|
|
||||||
if (bol_or_eol && begin_line && current == real_current)
|
|
||||||
break;
|
|
||||||
/* Otherwise, set the begin_line flag if we've found a match on
|
|
||||||
* the beginning line, reset the bol_or_eol flag, and
|
|
||||||
* continue. */
|
|
||||||
else {
|
|
||||||
if (current == real_current)
|
|
||||||
begin_line = TRUE;
|
|
||||||
bol_or_eol = FALSE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!replaceall) {
|
if (!replaceall) {
|
||||||
placewewant = xplustabs();
|
placewewant = xplustabs();
|
||||||
edit_redraw(current_save, old_pww);
|
edit_redraw(current_save, old_pww);
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user