search: don't set placewewant when we are just iterating

In the innermost search loop, don't set placewewant, because this loop
is also used for replacing and spell fixing, when we don't really want
to be there: we are just passing through.  Not setting placewewant means
we don't need to save and restore it in those passing-through routines.

The value of placewewant is only relevant when doing cursor movement,
which doesn't happen during replacing nor spell checking, so there is
no need to keep placewewant up to date -- it is set when it matters:
at the end of go_looking().
master
Benno Schulenberg 2016-04-10 09:33:49 +02:00
parent 7ba356a62c
commit ea4e9b3156
2 changed files with 1 additions and 7 deletions

View File

@ -384,7 +384,6 @@ int findnextstr(
/* Set the current position to point at what we found. */
openfile->current = fileptr;
openfile->current_x = found - fileptr->data;
openfile->placewewant = xplustabs();
openfile->current_y = fileptr->lineno - openfile->edittop->lineno;
/* When requested, pass back the length of the match. */
@ -797,7 +796,7 @@ ssize_t do_replace_loop(
void do_replace(void)
{
filestruct *edittop_save, *begin;
size_t begin_x, pww_save;
size_t begin_x;
ssize_t numreplaced;
int i;
@ -848,7 +847,6 @@ void do_replace(void)
edittop_save = openfile->edittop;
begin = openfile->current;
begin_x = openfile->current_x;
pww_save = openfile->placewewant;
numreplaced = do_replace_loop(
#ifndef DISABLE_SPELLER
@ -860,7 +858,6 @@ void do_replace(void)
openfile->edittop = edittop_save;
openfile->current = begin;
openfile->current_x = begin_x;
openfile->placewewant = pww_save;
edit_refresh();

View File

@ -2354,7 +2354,6 @@ bool do_int_spell_fix(const char *word)
{
char *save_search, *exp_word;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
filestruct *edittop_save = openfile->edittop;
filestruct *current_save = openfile->current;
/* Save where we are. */
@ -2416,7 +2415,6 @@ bool do_int_spell_fix(const char *word)
openfile->edittop = openfile->fileage;
openfile->current = openfile->fileage;
openfile->current_x = (size_t)-1;
openfile->placewewant = 0;
findnextstr_wrap_reset();
@ -2490,7 +2488,6 @@ bool do_int_spell_fix(const char *word)
openfile->edittop = edittop_save;
openfile->current = current_save;
openfile->current_x = current_x_save;
openfile->placewewant = pww_save;
/* Restore the settings of the global flags. */
memcpy(flags, stash, sizeof(flags));