From 0662fc4d4289b39e795aaf4a0532cbf18b59f771 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 8 Feb 2023 17:15:05 +0100 Subject: [PATCH] shutdown: ignore a modified buffer when in view mode In view mode it should be impossible to modify any buffer, but... when (through some bug) the user did succeed in modifying a buffer, this should not lead to writing out this modified buffer to disk. Had this safety stop been present earlier, it would have prevented the second part of https://savannah.gnu.org/bugs/?63616. --- src/nano.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nano.c b/src/nano.c index c6db6dd3..4d5e7ea6 100644 --- a/src/nano.c +++ b/src/nano.c @@ -303,7 +303,7 @@ void do_exit(void) /* When unmodified, simply close. Else, when doing automatic saving * and the file has a name, simply save. Otherwise, ask the user. */ - if (!openfile->modified) + if (!openfile->modified || ISSET(VIEW_MODE)) choice = NO; else if (ISSET(SAVE_ON_EXIT) && openfile->filename[0] != '\0') choice = YES;