commit 1d43db879eb4d658671bd38f99d2a4bc50021d5d
parent 97133f59634c1e795656713bc5332facd02b00da
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date: Fri, 14 May 2004 17:57:00 +0000
if multibuffer support is compiled in, properly read in multiple files
at the command line even if multibuffer mode isn't turned on
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1740 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/ChangeLog b/ChangeLog
@@ -65,6 +65,14 @@ CVS code -
- Don't open the first file in quiet mode, since if we do, an
error message won't be shown if it's unreadable. (DLR; found
by Jaap Eldering)
+ - If we've specified multiple files on the command line and
+ multibuffer support is compiled in, turn multibuffer mode on
+ when reading those files and turn it off afterward if it was
+ off before. This allows us to open multiple files without
+ having to turn multibuffer mode on at the command line or in
+ the nanorc first, both of which are unintuitive. Multibuffer
+ mode should only affect how the "Read File" command behaves
+ anyway. (DLR)
- nano.h:
- Since REGEXP_COMPILED is only used in search.c, convert it
from a flag to a static int there. (DLR)
diff --git a/src/nano.c b/src/nano.c
@@ -3520,7 +3520,9 @@ int main(int argc, char *argv[])
/* If we're using multibuffers and more than one file is specified
on the command line, load them all and switch to the first one
afterward */
- if (ISSET(MULTIBUFFER) && optind + 1 < argc) {
+ if (optind + 1 < argc) {
+ int old_multibuffer = ISSET(MULTIBUFFER);
+ SET(MULTIBUFFER);
for (optind++; optind < argc; optind++) {
add_open_file(1);
new_file();
@@ -3529,6 +3531,8 @@ int main(int argc, char *argv[])
load_file(0);
}
open_nextfile_void();
+ if (!old_multibuffer)
+ UNSET(MULTIBUFFER);
}
#endif