From 648eac936eedfd0f2494f728b3ccbe716647cbae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Diego=20Aur=C3=A9lio=20Mesquita?= Date: Tue, 19 May 2020 15:20:10 -0300 Subject: [PATCH] files: make the M-F (New Buffer) toggle non-persistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Having the M-F toggle non-persistent, makes the behavior of ^R predictable. This allows string binds that load a file to work correctly independently of when M-F was last pressed. The -F/--multibuffer command-line option and "set multibuffer" in a nanorc file determine the default behavior of ^R. Signed-off-by: Marco Diego Aurélio Mesquita --- src/files.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/files.c b/src/files.c index edfa314c..0286004f 100644 --- a/src/files.c +++ b/src/files.c @@ -1089,6 +1089,9 @@ void do_insertfile(bool execute) const char *msg; char *given = copy_of(""); /* The last answer the user typed at the status-bar prompt. */ +#ifdef ENABLE_MULTIBUFFER + bool was_multibuffer = ISSET(MULTIBUFFER); +#endif #ifndef NANO_TINY format_type was_fmt = openfile->fmt; #endif @@ -1273,6 +1276,13 @@ void do_insertfile(bool execute) } free(given); + +#ifdef ENABLE_MULTIBUFFER + if (was_multibuffer) + SET(MULTIBUFFER); + else + UNSET(MULTIBUFFER); +#endif } /* If the current mode of operation allows it, go insert a file. */