search: terminate the loop a tiny bit earlier when spell checking

The internal spell checker starts searching/replacing always at the top
of the buffer, so reaching the end of the buffer means we're done with
the current search/replace.  This prevents the "Search Wrapped" message
from flashing over the statusbar at the end of a spelling replacement.
This commit is contained in:
Benno Schulenberg 2016-05-01 11:18:20 +02:00
parent ae8df00b92
commit 3c8647e713

View File

@ -308,13 +308,6 @@ int findnextstr(
#ifndef DISABLE_SPELLER
bool found_whole = FALSE;
/* Is this potential match a whole word? */
/* When we're spell-checking, don't search in the starting line
* again -- there is no need: we started at x = 0. */
if (whole_word_only && came_full_circle) {
disable_nodelay();
return 0;
}
#endif
/* Remember the length of the potential match. */
found_len =
@ -359,12 +352,20 @@ int findnextstr(
/* If we've reached the start or end of the buffer, wrap around. */
if (fileptr == NULL) {
#ifndef DISABLE_SPELLER
/* When we're spell-checking, end-of-buffer means we're done. */
if (whole_word_only) {
disable_nodelay();
return 0;
}
#endif
#ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH))
fileptr = openfile->filebot;
else
#endif
fileptr = openfile->fileage;
statusbar(_("Search Wrapped"));
/* Delay the "Searching..." message for at least two seconds. */
feedback = -2;