mirror of
git://git.sv.gnu.org/nano.git
synced 2025-01-27 03:32:05 +03:00
in main(), tweak the command line parsing routine so that multiple +LINE
flags are properly interpreted in multibuffer mode git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2014 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
6a715b69a7
commit
bf1346f342
@ -163,6 +163,9 @@ CVS code -
|
|||||||
- Make goal a ssize_t instead of an int, since fill is now a
|
- Make goal a ssize_t instead of an int, since fill is now a
|
||||||
ssize_t, and the position at which a line is broken can be
|
ssize_t, and the position at which a line is broken can be
|
||||||
greater than COLS. (DLR)
|
greater than COLS. (DLR)
|
||||||
|
main()
|
||||||
|
- Tweak the command line parsing routine so that multiple +LINE
|
||||||
|
flags are properly interpreted in multibuffer mode. (DLR)
|
||||||
- nano.h:
|
- nano.h:
|
||||||
- Add WIDTH_OF_TAB #define, containing the default width of a
|
- Add WIDTH_OF_TAB #define, containing the default width of a
|
||||||
tab. (DLR)
|
tab. (DLR)
|
||||||
|
31
src/nano.c
31
src/nano.c
@ -3415,12 +3415,6 @@ int main(int argc, char **argv)
|
|||||||
if (tabsize == -1)
|
if (tabsize == -1)
|
||||||
tabsize = WIDTH_OF_TAB;
|
tabsize = WIDTH_OF_TAB;
|
||||||
|
|
||||||
/* If there's a +LINE flag, it is the first non-option argument. */
|
|
||||||
if (0 < optind && optind < argc && argv[optind][0] == '+') {
|
|
||||||
startline = atoi(&argv[optind][1]);
|
|
||||||
optind++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Back up the old terminal settings so that they can be restored. */
|
/* Back up the old terminal settings so that they can be restored. */
|
||||||
tcgetattr(0, &oldterm);
|
tcgetattr(0, &oldterm);
|
||||||
|
|
||||||
@ -3449,6 +3443,14 @@ int main(int argc, char **argv)
|
|||||||
fprintf(stderr, "Main: open file\n");
|
fprintf(stderr, "Main: open file\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* If there's a +LINE flag here, it is the first non-option
|
||||||
|
* argument, and it is followed by at least one other argument, the
|
||||||
|
* filename it applies to. */
|
||||||
|
if (0 < optind && optind < argc - 1 && argv[optind][0] == '+') {
|
||||||
|
startline = atoi(&argv[optind][1]);
|
||||||
|
optind++;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
old_multibuffer = ISSET(MULTIBUFFER);
|
old_multibuffer = ISSET(MULTIBUFFER);
|
||||||
SET(MULTIBUFFER);
|
SET(MULTIBUFFER);
|
||||||
@ -3456,9 +3458,20 @@ int main(int argc, char **argv)
|
|||||||
/* Read all the files after the first one on the command line into
|
/* Read all the files after the first one on the command line into
|
||||||
* new buffers. */
|
* new buffers. */
|
||||||
{
|
{
|
||||||
int i;
|
int i = optind + 1, iline = 0;
|
||||||
for (i = optind + 1; i < argc; i++)
|
for (; i < argc; i++) {
|
||||||
load_buffer(argv[i]);
|
/* If there's a +LINE flag here, it is followed by at least
|
||||||
|
* one other argument, the filename it applies to. */
|
||||||
|
if (i < argc - 1 && argv[i][0] == '+' && iline == 0) {
|
||||||
|
iline = atoi(&argv[i][1]);
|
||||||
|
} else {
|
||||||
|
load_buffer(argv[i]);
|
||||||
|
if (iline > 0) {
|
||||||
|
do_gotoline(iline, FALSE);
|
||||||
|
iline = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user