From 537b068d51f046e9a696c0c96d22c2f134c79bea 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] tweaks: make insert into current/new buffer toggle non-persistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By not having persistence on the MULTIBUFFER toggle, the behaviour when ^R (or Ins) is pressed is predictable. The -F, --multibuffer command line flags and the "set multibuffer" .nanorc setting are not ignored and define the default behaviour of ^R (or Ins). This will allow string binds that load files to work correctly indenpendently of the MULTIBUFFER toggle. Signed-off-by: Marco Diego Aurélio Mesquita --- src/files.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/files.c b/src/files.c index 103ec1ed..6b0d9837 100644 --- a/src/files.c +++ b/src/files.c @@ -1078,6 +1078,9 @@ void do_insertfile(void) 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; bool execute = FALSE; @@ -1257,6 +1260,12 @@ void do_insertfile(void) } 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. */ -- 2.17.1