Commit a1132c81 authored by Benno Schulenberg's avatar Benno Schulenberg
Browse files

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.
No related merge requests found
Showing with 1 addition and 1 deletion
+1 -1
......@@ -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);
......
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