nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 3c8647e713630f9e3ca8763af983320731511782
parent ae8df00b924414d8341503ea640155a502eb1b61
Author: Benno Schulenberg <bensberg@justemail.net>
Date:   Sun,  1 May 2016 11:18:20 +0200

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.

Diffstat:
Msrc/search.c | 15++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -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;