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
master
David Lawrence Ramsey 2004-05-14 17:57:00 +00:00
parent 97133f5963
commit 1d43db879e
2 changed files with 13 additions and 1 deletions

View File

@ -65,6 +65,14 @@ CVS code -
- Don't open the first file in quiet mode, since if we do, an - 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 error message won't be shown if it's unreadable. (DLR; found
by Jaap Eldering) 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: - nano.h:
- Since REGEXP_COMPILED is only used in search.c, convert it - Since REGEXP_COMPILED is only used in search.c, convert it
from a flag to a static int there. (DLR) from a flag to a static int there. (DLR)

View File

@ -3520,7 +3520,9 @@ int main(int argc, char *argv[])
/* If we're using multibuffers and more than one file is specified /* 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 on the command line, load them all and switch to the first one
afterward */ afterward */
if (ISSET(MULTIBUFFER) && optind + 1 < argc) { if (optind + 1 < argc) {
int old_multibuffer = ISSET(MULTIBUFFER);
SET(MULTIBUFFER);
for (optind++; optind < argc; optind++) { for (optind++; optind < argc; optind++) {
add_open_file(1); add_open_file(1);
new_file(); new_file();
@ -3529,6 +3531,8 @@ int main(int argc, char *argv[])
load_file(0); load_file(0);
} }
open_nextfile_void(); open_nextfile_void();
if (!old_multibuffer)
UNSET(MULTIBUFFER);
} }
#endif #endif