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.
master
Benno Schulenberg 2017-12-19 17:57:49 +01:00
parent 7ad5afb935
commit 31fe0753e3
1 changed files with 4 additions and 8 deletions

View File

@ -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;
}