From a1132c81a1f5322f6f7e6ef06b5c0b212dd29ab7 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 20 Mar 2018 10:31:03 +0100 Subject: [PATCH] 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. --- src/files.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index 48b7bb1d..4d987e22 100644 --- a/src/files.c +++ b/src/files.c @@ -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);