speller: do not replace the text when the temporary file did not change

master
Benno Schulenberg 2018-08-08 19:44:40 +02:00
parent 667fcea65e
commit 61b4eeda66
1 changed files with 4 additions and 6 deletions

View File

@ -2872,6 +2872,9 @@ const char *do_alt_speller(char *tempfile_name)
if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0)
return invocation_error(alt_speller);
/* Stat the temporary file again, and only read it in when it changed. */
stat(tempfile_name, &spellfileinfo);
if (spellfileinfo.st_mtime != timestamp) {
#ifndef NANO_TINY
/* Replace the marked text (or the entire text) of the current buffer
* with the spell-checked text. */
@ -2905,12 +2908,7 @@ const char *do_alt_speller(char *tempfile_name)
openfile->current_x = strlen(openfile->current->data);
openfile->placewewant = pww_save;
adjust_viewport(STATIONARY);
/* Stat the temporary file again, and mark the buffer as modified only
* if this file was changed since it was written. */
stat(tempfile_name, &spellfileinfo);
if (spellfileinfo.st_mtime != timestamp)
set_modified();
}
#ifndef NANO_TINY
/* Unblock SIGWINCHes again. */