miscellaneous cleanups in do_replace_loop(): set current to real_current

and current_x to current_x_save, only turn the mark off and call
edit_refresh() if the mark was originally on, and make length_change a
ssize_t


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1977 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
David Lawrence Ramsey 2004-10-08 23:06:01 +00:00
parent f3b10e8e05
commit 491cad3e5d
2 changed files with 15 additions and 8 deletions

View File

@ -149,6 +149,11 @@ CVS code -
the search prompt to the "Go To Line" prompt, since the the search prompt to the "Go To Line" prompt, since the
toggling works both ways now and non-numeric text shouldn't be toggling works both ways now and non-numeric text shouldn't be
lost when going only one of those ways. (DLR) lost when going only one of those ways. (DLR)
do_replace_loop()
- Miscellaneous cleanups: set current to real_current and
current_x to current_x_save, only turn the mark off and call
edit_refresh() if the mark was originally on, and make
length_change a ssize_t. (DLR)
findnextstr() findnextstr()
- Take the no_sameline parameter after can_display_wrap and - Take the no_sameline parameter after can_display_wrap and
wholewords, not after all other parameters. (DLR) wholewords, not after all other parameters. (DLR)

View File

@ -604,9 +604,9 @@ char *replace_line(const char *needle)
} }
/* Step through each replace word and prompt user before replacing. /* Step through each replace word and prompt user before replacing.
* Parameters real_current and real_current_x are needed by the internal * Parameters real_current and real_current_x are needed in order to
* speller, to allow the cursor position to be updated when a word * allow the cursor position to be updated when a word before the cursor
* before the cursor is replaced by a shorter word. * is replaced by a shorter word.
* *
* needle is the string to seek. We replace it with answer. Return -1 * needle is the string to seek. We replace it with answer. Return -1
* if needle isn't found, else the number of replacements performed. */ * if needle isn't found, else the number of replacements performed. */
@ -614,8 +614,8 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
size_t *real_current_x, bool wholewords) size_t *real_current_x, bool wholewords)
{ {
int numreplaced = -1; int numreplaced = -1;
size_t old_pww = placewewant, current_x_save = current_x; size_t old_pww = placewewant, current_x_save = *real_current_x;
const filestruct *current_save = current; 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. */
@ -624,8 +624,10 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
#ifndef NANO_SMALL #ifndef NANO_SMALL
bool old_mark_set = ISSET(MARK_ISSET); bool old_mark_set = ISSET(MARK_ISSET);
if (old_mark_set) {
UNSET(MARK_ISSET); UNSET(MARK_ISSET);
edit_refresh(); edit_refresh();
}
#endif #endif
while (findnextstr(TRUE, wholewords, while (findnextstr(TRUE, wholewords,
@ -707,7 +709,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
if (i > 0 || replaceall) { /* Yes, replace it!!!! */ if (i > 0 || replaceall) { /* Yes, replace it!!!! */
char *copy; char *copy;
int length_change; ssize_t length_change;
if (i == 2) if (i == 2)
replaceall = TRUE; replaceall = TRUE;