From: Benno Schulenberg Date: Fri, 20 Jun 2014 19:10:24 +0000 (+0000) Subject: Letting +1 and +,1 make nano start on line one column one, overriding X-Git-Tag: v2.3.5~57 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=3060ce36d30e556e4023b2ba90cd7cb84c259fa2;p=nano.git Letting +1 and +,1 make nano start on line one column one, overriding a position from history. This fixes Savannah bug #42538. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5003 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/ChangeLog b/ChangeLog index a23fdb68..e651bb4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,8 @@ * src/nano.c: Fix compilation with --enable-tiny --enable-mouse. * doc/man/nanorc.5, doc/texinfo/nano.texi: Explain better what "all" means when rebinding keys. This is a fix for Savannah bug #42552. + * src/nano.c (main): Make +1 and +,1 start on line one column one, + overriding a historical position. This fixes Savannah bug #42538. 2014-06-19 Benno Schulenberg * src/nano.c (window_init): Rename 'no_more_space()' to 'more_space()' diff --git a/src/nano.c b/src/nano.c index 8ea8617e..6e4d1734 100644 --- a/src/nano.c +++ b/src/nano.c @@ -2102,10 +2102,8 @@ void do_output(char *output, size_t output_len, bool allow_cntrls) int main(int argc, char **argv) { int optchr; - ssize_t startline = 1; - /* Line to try and start at. */ - ssize_t startcol = 1; - /* Column to try and start at. */ + ssize_t startline = 0, startcol = 0; + /* Target line and column when specified on the command line. */ #ifndef DISABLE_WRAPJUSTIFY bool fill_used = FALSE; /* Was the fill option used? */ @@ -2716,7 +2714,7 @@ int main(int argc, char **argv) * new buffers. */ { int i = optind + 1; - ssize_t iline = 1, icol = 1; + ssize_t iline = 0, icol = 0; for (; i < argc; i++) { /* If there's a +LINE or +LINE,COLUMN flag here, it is @@ -2728,7 +2726,7 @@ int main(int argc, char **argv) else { open_buffer(argv[i], FALSE); - if (iline > 1 || icol > 1) { + if (iline > 0 || icol > 0) { do_gotolinecolumn(iline, icol, FALSE, FALSE, FALSE, FALSE); iline = 1; @@ -2778,7 +2776,7 @@ int main(int argc, char **argv) precalc_multicolorinfo(); #endif - if (startline > 1 || startcol > 1) + if (startline > 0 || startcol > 0) do_gotolinecolumn(startline, startcol, FALSE, FALSE, FALSE, FALSE); #ifndef DISABLE_HISTORIES