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.
master
Benno Schulenberg 2016-05-01 11:18:20 +02:00
parent ae8df00b92
commit 3c8647e713
1 changed files with 8 additions and 7 deletions

View File

@ -308,13 +308,6 @@ int findnextstr(
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
bool found_whole = FALSE; bool found_whole = FALSE;
/* Is this potential match a whole word? */ /* 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 #endif
/* Remember the length of the potential match. */ /* Remember the length of the potential match. */
found_len = found_len =
@ -359,12 +352,20 @@ int findnextstr(
/* If we've reached the start or end of the buffer, wrap around. */ /* If we've reached the start or end of the buffer, wrap around. */
if (fileptr == NULL) { 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 #ifndef NANO_TINY
if (ISSET(BACKWARDS_SEARCH)) if (ISSET(BACKWARDS_SEARCH))
fileptr = openfile->filebot; fileptr = openfile->filebot;
else else
#endif #endif
fileptr = openfile->fileage; fileptr = openfile->fileage;
statusbar(_("Search Wrapped")); statusbar(_("Search Wrapped"));
/* Delay the "Searching..." message for at least two seconds. */ /* Delay the "Searching..." message for at least two seconds. */
feedback = -2; feedback = -2;