speller: give proper feedback when the user tries to check emptiness

(The wording is general, because it should cover also the formatter.)

This fixes https://savannah.gnu.org/bugs/?58865.

Bug existed since version 4.6, commit d2fb371f.
This commit is contained in:
Benno Schulenberg 2020-08-01 20:38:29 +02:00
parent 67d22f4cce
commit 844f95e6df
1 changed files with 6 additions and 1 deletions

View File

@ -2104,8 +2104,13 @@ void treat(char *tempfile_name, char *theprogram, bool spelling)
/* Stat the temporary file. If that succeeds and its size is zero,
* there is nothing to do; otherwise, store its time of modification. */
if (stat(tempfile_name, &fileinfo) == 0) {
if (fileinfo.st_size == 0)
if (fileinfo.st_size == 0) {
if (spelling && openfile->mark)
statusline(ALERT, _("Selection is empty"));
else
statusbar(_("Buffer is empty"));
return;
}
timestamp_sec = (long)fileinfo.st_mtim.tv_sec;
timestamp_nsec = (long)fileinfo.st_mtim.tv_nsec;