nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 0662fc4d4289b39e795aaf4a0532cbf18b59f771
parent 078d612b9ef5cf39c9c83ed64b0761d8e581a34b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Wed,  8 Feb 2023 17:15:05 +0100

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.

Diffstat:
Msrc/nano.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 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;