- Add support for reading in UTF-8 sequences to the low-level
input routines. Changes to get_kbinput() and
get_translated_kbinput(). (DLR)
+ - Reduce search_last_line to a local variable in findnextstr(),
+ since it's always set to FALSE just before and after
+ findnextstr() is called and isn't used anywhere except in
+ findnextstr(). Changes to do_int_spell_fix(), findnextstr(),
+ do_search(), do_research(), do_replace(), and
+ do_find_bracket(). (DLR)
- files.c:
do_insertfile()
- Readd the NANO_SMALL #ifdef around the start_again: label to
NANO_SMALL is defined and DISABLE_SPELLER isn't. Also, turn
the USE_REGEXP flag off during spell checking in order to
avoid a potential segfault. (DLR)
- - Fully save the position in the file, using edittop, current,
- current_x, and placewewant. (DLR)
do_alt_speller()
- Call terminal_init() unconditionally after running the
alternate spell checker, so that the terminal state is
{
char *save_search;
char *save_replace;
- size_t current_x_save = current_x, pww_save = placewewant;
+ size_t current_x_save = current_x;
filestruct *edittop_save = edittop;
filestruct *current_save = current;
/* Save where we are. */
edittop = fileage;
current = fileage;
current_x = -1;
- placewewant = 0;
-
- search_last_line = FALSE;
/* Find the first whole-word occurrence of word. */
while (findnextstr(TRUE, TRUE, FALSE, fileage, 0, word, NULL)) {
do_replace_highlight(FALSE, word);
if (accepted && strcmp(word, answer) != 0) {
- search_last_line = FALSE;
current_x--;
do_replace_loop(word, current_save, ¤t_x_save, TRUE);
}
edittop = edittop_save;
current = current_save;
current_x = current_x_save;
- placewewant = pww_save;
/* Restore case sensitivity setting. */
if (!case_sens_set)
extern long totsize;
extern long flags;
extern ssize_t tabsize;
-extern int search_last_line;
extern int currslen;
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
#include "nano.h"
#ifdef HAVE_REGEX_H
-static int regexp_compiled = FALSE;
+static bool regexp_compiled = FALSE;
+ /* Have we compiled any regular expressions? */
/* Regular expression helper functions. */
size_t current_x_find = 0;
/* The location of the match we found. */
int current_y_find = current_y;
+ bool search_last_line = FALSE;
+ /* Have we gone past the last line while searching? */
/* rev_start might end up 1 character before the start or after the
* end of the line. This won't be a problem because strstrwrapper()
update_history(&search_history, answer);
#endif
- search_last_line = FALSE;
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
answer, NULL);
return;
#endif
- search_last_line = FALSE;
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
last_search, NULL);
last_replace = mallocstrcpy(last_replace, answer);
/* Save where we are. */
+ edittop_save = edittop;
begin = current;
beginx = current_x;
- edittop_save = edittop;
- search_last_line = FALSE;
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
edittop = edittop_save;
current = begin;
current_x = beginx;
+
renumber_all();
edit_refresh();
/* We constructed regexp_pat to be a valid expression. */
assert(regexp_compiled);
- search_last_line = FALSE;
while (TRUE) {
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
regexp_pat, NULL)) {