commit 648eac936eedfd0f2494f728b3ccbe716647cbae
parent 26fb83c61fa32db6705ba6fa1d737058960d7ead
Author: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Date: Tue, 19 May 2020 15:20:10 -0300
files: make the M-F (New Buffer) toggle non-persistent
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 <marcodiegomesquita@gmail.com>
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git 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. */