From 57911ea8393cddcd834614b7c6e755f5e8696749 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 flag non-persistent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By not having persistence on the MULTIBUFFER flag, 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 flag. Signed-off-by: Marco Diego Aurélio Mesquita --- src/files.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/files.c b/src/files.c index 6bcfaab3..df786a70 100644 --- a/src/files.c +++ b/src/files.c @@ -1074,6 +1074,7 @@ void do_insertfile(void) const char *msg; char *given = copy_of(""); /* The last answer the user typed at the status-bar prompt. */ + bool was_multibuffer = ISSET(MULTIBUFFER); #ifndef NANO_TINY format_type was_fmt = openfile->fmt; bool execute = FALSE; @@ -1253,6 +1254,10 @@ void do_insertfile(void) } free(given); + if (was_multibuffer) + SET(MULTIBUFFER); + else + UNSET(MULTIBUFFER); } /* If the current mode of operation allows it, go insert a file. */ -- 2.17.1