commit 31fe0753e37d4901f0a8140b1cf5889cbacc37e7
parent 7ad5afb935086d9b19c9d55a350520a78b6af1d4
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Tue, 19 Dec 2017 17:57:49 +0100
tweaks: limit the resetting of "Modified" to writing a full buffer
When doing that, there is no need to save and restore the Modified
state when writing a marked region.
Diffstat:
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/files.c b/src/files.c
@@ -1949,16 +1949,17 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
#endif
}
+ if (fullbuffer) {
#ifndef NANO_TINY
- if (fullbuffer)
/* Get or update the stat info to reflect the current state. */
stat_with_alloc(realname, &openfile->current_stat);
#endif
+ openfile->modified = FALSE;
+ titlebar(NULL);
+ }
statusline(HUSH, P_("Wrote %zu line", "Wrote %zu lines",
lineswritten), lineswritten);
- openfile->modified = FALSE;
- titlebar(NULL);
}
retval = TRUE;
@@ -1977,8 +1978,6 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
kind_of_writing_type method)
{
bool retval;
- bool old_modified = openfile->modified;
- /* Save the status, as writing the file unsets the modified flag. */
bool added_magicline = FALSE;
/* Whether we added a magicline after filebot. */
filestruct *top, *bot;
@@ -2005,9 +2004,6 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
/* Unpartition the buffer so that it contains all the text again. */
unpartition_filestruct(&filepart);
- if (old_modified)
- set_modified();
-
return retval;
}