main loop. This prevents a segfault when trying to open a directory.
* src/search.c (findnextstr): Provide feedback when searching takes
longer than roughly half a second (on average).
+ * src/*.c: Remove the 'last_replace' variable that is never used.
2016-03-23 Benno Schulenberg <bensberg@justemail.net>
* src/search.c (findnextstr): Prevent the internal spell checker from
char *last_search = NULL;
/* The last string we searched for. */
-char *last_replace = NULL;
- /* The last replacement string we searched for. */
unsigned flags[4] = {0, 0, 0, 0};
/* Our flag containing the states of all global options. */
#endif
free(answer);
free(last_search);
- free(last_replace);
#ifndef DISABLE_SPELLER
free(alt_speller);
#endif
}
#endif /* !NANO_TINY */
- /* Initialize the search and replace strings. */
+ /* Initialize the search string. */
last_search = mallocstrcpy(NULL, "");
- last_replace = mallocstrcpy(NULL, "");
/* If tabsize wasn't specified, set its default value. */
if (tabsize == -1)
#endif
extern char *last_search;
-extern char *last_replace;
extern unsigned flags[4];
extern WINDOW *topwin;
* text in the passed string only when create is TRUE. */
int replace_regexp(char *string, bool create)
{
- const char *c = last_replace;
+ const char *c = answer;
size_t replacement_size = 0;
/* Iterate through the replacement text to handle subexpression
return;
}
- last_replace = mallocstrcpy(last_replace, answer);
-
/* Save where we are. */
edittop_save = openfile->edittop;
begin = openfile->current;
* return FALSE if the user cancels. */
bool do_int_spell_fix(const char *word)
{
- char *save_search, *save_replace;
+ char *save_search;
size_t match_len, current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
filestruct *edittop_save = openfile->edittop;
UNSET(USE_REGEXP);
#endif
- /* Save the current search/replace strings. */
+ /* Save the current search string, then set it to the misspelled word. */
save_search = last_search;
- save_replace = last_replace;
-
- /* Set the search/replace strings to the misspelled word. */
last_search = mallocstrcpy(NULL, word);
- last_replace = mallocstrcpy(NULL, word);
focusing = TRUE;
}
#endif /* !NANO_TINY */
- /* Restore the search/replace strings. */
+ /* Restore the string that was last searched for. */
free(last_search);
last_search = save_search;
- free(last_replace);
- last_replace = save_replace;
/* Restore where we were. */
openfile->edittop = edittop_save;