files: prevent the undo of reading a file into a new buffer

When the file has just been read, it is in the state that it has
on disk, so there is nothing to undo.

This fixes https://savannah.gnu.org/bugs/?53387.
master
Benno Schulenberg 2018-03-20 10:31:03 +01:00
parent 0496aed4ab
commit a1132c81a1
1 changed files with 1 additions and 1 deletions

View File

@ -483,7 +483,7 @@ bool open_buffer(const char *filename, bool undoable)
/* If we have a non-new file, read it in. Then, if the buffer has
* no stat, update the stat, if applicable. */
if (rc > 0) {
read_file(f, rc, realname, undoable, new_buffer);
read_file(f, rc, realname, undoable && !new_buffer, new_buffer);
#ifndef NANO_TINY
if (openfile->current_stat == NULL)
stat_with_alloc(realname, &openfile->current_stat);