From: Benno Schulenberg Date: Mon, 23 Mar 2015 17:01:25 +0000 (+0000) Subject: Avoiding a spell-check error when the marked region is zero bytes long. X-Git-Tag: v2.4.1~42 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=92142bed346950ebd883d71a982a8a652f6af0db;p=nano.git Avoiding a spell-check error when the marked region is zero bytes long. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5155 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index 208fb91c..54af3501 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2015-03-23 Benno Schulenberg + * src/text.c (do_alt_speller): Avoid the spell checker reporting + an error when the marked region is zero bytes long. The message + is not needed -- it gets printed by the caller. This generalizes + the fix for Savannah bug #29393. + 2015-03-22 Chris Allegretta * src/text.c (do_alt_speller): timestamp can just be a __time_t. Fixes compilation on win32. diff --git a/src/text.c b/src/text.c index 4495c467..816f7616 100644 --- a/src/text.c +++ b/src/text.c @@ -2692,15 +2692,14 @@ const char *do_alt_speller(char *tempfile_name) } #endif - if (openfile->totsize == 0) { - statusbar(_("Finished checking spelling")); - return NULL; - } - - /* Get the timestamp of the temporary file. */ + /* Get the timestamp and the size of the temporary file. */ stat(tempfile_name, &spellfileinfo); timestamp = spellfileinfo.st_mtime; + /* If the number of bytes to check is zero, get out. */ + if (spellfileinfo.st_size == 0) + return NULL; + endwin(); /* Set up an argument list to pass execvp(). */