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>master
parent
26fb83c61f
commit
648eac936e
10
src/files.c
10
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. */
|
||||
|
|
Loading…
Reference in New Issue