Commit 3de81bc3 authored by David Lawrence Ramsey's avatar David Lawrence Ramsey
Browse files

in do_replace_loop(), treat real_current as current and real_current_x

as current_x instead of using copies of them (which aren't kept up to
date) when calling findnextstr(); this fixes a problem where the search
can wrap when it shouldn't and skip over all matches after the wrap
point


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2119 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 5 additions and 6 deletions
+5 -6
...@@ -290,8 +290,8 @@ CVS code - ...@@ -290,8 +290,8 @@ CVS code -
flag, and add new parameter needle_len (used to return the flag, and add new parameter needle_len (used to return the
length of the match). (DLR) length of the match). (DLR)
do_replace_loop() do_replace_loop()
- Miscellaneous cleanups: set current to real_current and - Miscellaneous cleanups: treat real_current as current and
current_x to current_x_save, only turn the mark off and call real_current_x as current_x, only turn the mark off and call
edit_refresh() if the mark was originally on, and make edit_refresh() if the mark was originally on, and make
length_change a ssize_t. (DLR) length_change a ssize_t. (DLR)
- Return ssize_t instead of int. (DLR) - Return ssize_t instead of int. (DLR)
......
...@@ -671,8 +671,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct ...@@ -671,8 +671,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
{ {
ssize_t numreplaced = -1; ssize_t numreplaced = -1;
size_t match_len; size_t match_len;
size_t pww_save = placewewant, current_x_save = *real_current_x; size_t pww_save = placewewant;
const filestruct *current_save = real_current;
bool replaceall = FALSE; bool replaceall = FALSE;
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
/* The starting-line match and bol/eol regex flags. */ /* The starting-line match and bol/eol regex flags. */
...@@ -713,7 +712,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct ...@@ -713,7 +712,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
#else #else
FALSE FALSE
#endif #endif
, current_save, current_x_save, needle, &match_len)) { , real_current, *real_current_x, needle, &match_len)) {
int i = 0; int i = 0;
...@@ -735,7 +734,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct ...@@ -735,7 +734,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
#endif #endif
if (!replaceall) { if (!replaceall) {
edit_redraw(current_save, pww_save); edit_redraw(real_current, pww_save);
pww_save = placewewant; pww_save = placewewant;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment