nano

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

commit 61b4eeda662d33f579c7118df05f56c506ef2ff9
parent 667fcea65ed32ca09055e893f493e899e9b5ae0f
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed,  8 Aug 2018 19:44:40 +0200

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

Diffstat:
Msrc/text.c | 10++++------
1 file changed, 4 insertions(+), 6 deletions(-)

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