Commit 31fe0753 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 4 additions and 8 deletions
+4 -8
......@@ -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;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment