Not setting the modified flag when an external spell checker

didn't make any changes.


git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5140 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-03-17 20:10:59 +00:00
parent 6898c60ba6
commit 52d1c20973
2 changed files with 18 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2015-03-17 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_alt_speller): Do not set the modified flag when
an external spell checker didn't make any changes. This fixes
Savannah bug #44320, reported by Cody A. Taylor.
2015-03-14 Benno Schulenberg <bensberg@justemail.net>
* src/text.c (do_formatter): Fix a message plus a few comments.

View File

@ -2664,6 +2664,8 @@ const char *do_alt_speller(char *tempfile_name)
size_t pww_save = openfile->placewewant;
ssize_t current_y_save = openfile->current_y;
ssize_t lineno_save = openfile->current->lineno;
struct stat spellfileinfo;
__time_t timestamp;
pid_t pid_spell;
char *ptr;
static int arglen = 3;
@ -2699,6 +2701,10 @@ const char *do_alt_speller(char *tempfile_name)
return NULL;
}
/* Get the timestamp of the temporary file. */
stat(tempfile_name, &spellfileinfo);
timestamp = spellfileinfo.st_mtime;
endwin();
/* Set up an argument list to pass execvp(). */
@ -2841,9 +2847,14 @@ const char *do_alt_speller(char *tempfile_name)
}
#endif
/* Go back to the old position, and mark the file as modified. */
/* Go back to the old position. */
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
set_modified();
/* 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
/* Handle a pending SIGWINCH again. */