Adjusting some comments for clarity and accuracy, and rewrapping some lines.

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5312 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Benno Schulenberg 2015-07-19 09:25:25 +00:00
parent 9dc544acbd
commit d52f108526
2 changed files with 15 additions and 18 deletions

View File

@ -1,6 +1,7 @@
2015-07-19 Benno Schulenberg <bensberg@justemail.net> 2015-07-19 Benno Schulenberg <bensberg@justemail.net>
* src/nano.c (main): Accept again a +LINE argument for each file * src/nano.c (main): Accept again a +LINE argument for each file
given on the command line. This fixes Savannah bug #45576. given on the command line. This fixes Savannah bug #45576.
* src/nano.c (main): Adjust some comments and rewrap some lines.
2015-07-18 Benno Schulenberg <bensberg@justemail.net> 2015-07-18 Benno Schulenberg <bensberg@justemail.net>
* src/winio.c (edit_draw): When looking for multiline-regex matches, * src/winio.c (edit_draw): When looking for multiline-regex matches,

View File

@ -2710,27 +2710,26 @@ int main(int argc, char **argv)
ssize_t iline = 0, icol = 0; ssize_t iline = 0, icol = 0;
for (; i < argc; i++) { for (; i < argc; i++) {
/* If there's a +LINE or +LINE,COLUMN flag here, it is /* If there's a +LINE or +LINE,COLUMN flag here, it is followed
* followed by at least one other argument, the filename it * by at least one other argument: the filename it applies to. */
* applies to. */
if (i < argc - 1 && argv[i][0] == '+') if (i < argc - 1 && argv[i][0] == '+')
parse_line_column(&argv[i][1], &iline, &icol); parse_line_column(&argv[i][1], &iline, &icol);
else { else {
open_buffer(argv[i], FALSE); open_buffer(argv[i], FALSE);
/* If a position was given on the command line, go there. */
if (iline > 0 || icol > 0) { if (iline > 0 || icol > 0) {
do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE, do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE, FALSE);
FALSE);
iline = 0; iline = 0;
icol = 0; icol = 0;
} }
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
else { else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol; ssize_t savedposline, savedposcol;
/* If edited before, restore the last cursor position. */
if (check_poshistory(argv[i], &savedposline, &savedposcol)) if (check_poshistory(argv[i], &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, do_gotolinecolumn(savedposline, savedposcol, FALSE,
FALSE); FALSE, FALSE, FALSE);
} }
#endif #endif
} }
@ -2738,16 +2737,13 @@ int main(int argc, char **argv)
} }
#endif /* !DISABLE_MULTIBUFFER */ #endif /* !DISABLE_MULTIBUFFER */
/* Read the first file on the command line into either the current /* Now read the first file on the command line into a new buffer. */
* buffer or a new buffer, depending on whether multibuffer mode is
* enabled. */
if (optind < argc) if (optind < argc)
open_buffer(argv[optind], FALSE); open_buffer(argv[optind], FALSE);
/* We didn't open any files if all the command line arguments were /* If all the command-line arguments were invalid files like directories,
* invalid files like directories or if there were no command line * or if there were no filenames given, we didn't open any file. In this
* arguments given. In this case, we have to load a blank buffer. * case, load a blank buffer. Also, unset view mode to allow editing. */
* Also, we unset view mode to allow editing. */
if (openfile == NULL) { if (openfile == NULL) {
open_buffer("", FALSE); open_buffer("", FALSE);
UNSET(VIEW_MODE); UNSET(VIEW_MODE);
@ -2768,13 +2764,13 @@ int main(int argc, char **argv)
precalc_multicolorinfo(); precalc_multicolorinfo();
#endif #endif
/* If a starting position was given on the command line, go there. */
if (startline > 0 || startcol > 0) if (startline > 0 || startcol > 0)
do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE, do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE, FALSE);
FALSE);
#ifndef DISABLE_HISTORIES #ifndef DISABLE_HISTORIES
else { else {
/* See if we have a POS history to use if we haven't overridden it. */
ssize_t savedposline, savedposcol; ssize_t savedposline, savedposcol;
/* If the file was edited before, restore the last cursor position. */
if (check_poshistory(argv[optind], &savedposline, &savedposcol)) if (check_poshistory(argv[optind], &savedposline, &savedposcol))
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE); do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE, FALSE, FALSE);
} }