.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
-.TH NANO 1 "version 1.3.7" "March 26, 2005"
+.TH NANO 1 "version 1.3.7" "May 16, 2005"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH SYNOPSIS
.B nano
-.I [\+LINE]\ [options]\ [file]
+.I [\+LINE,COLUMN]\ [options]\ [file]
.br
.SH DESCRIPTION
.SH OPTIONS
.TP
-.B \+\fILINE\fP
-Places cursor at line number \fILINE\fP on startup, instead of the
-default of line 1.
+.B \+\fILINE\fP,\fICOLUMN\fP]
+Places cursor at line number \fILINE\fP and column number \fICOLUMN\fP
+on startup, instead of the default of line 1, column 1.
.TP
.B \-?
Same as \fB-h (\-\-help)\fP.
@smallbook
@set EDITION 0.1
@set VERSION 1.3.7
-@set UPDATED 26 Mar 2005
+@set UPDATED 16 May 2005
@dircategory Editors
@direntry
@node Overview, Command Line Options, Introduction, Introduction
@section Overview
-@code{nano} +LINE [GNU long option] [option] [ @var{file ...} ]
+@code{nano} +LINE,COLUMN [GNU long option] [option] [ @var{file ...} ]
The original goal for @code{nano} was a complete bug-for-bug compatible
emulation of Pico, but @code{nano}'s main goal is to be as compatible as
@code{nano} takes the following options from the command line:
@table @code
-@item +LINE
-Start at line number LINE instead of the default of line 1.
+@item +LINE,COLUMN
+Start at line number LINE and column number COLUMN instead of the
+default of line 1, column 1.
@item -?
Same as @code{-h, --help}.
void usage(void)
{
#ifdef HAVE_GETOPT_LONG
- printf(_("Usage: nano [+LINE] [GNU long option] [option] [file]\n\n"));
+ printf(_("Usage: nano [+LINE,COLUMN] [GNU long option] [option] [file]\n\n"));
printf(_("Option\t\tLong option\t\tMeaning\n"));
#else
printf(_("Usage: nano [+LINE] [option] [file]\n\n"));
#endif
print1opt("-h, -?", "--help", N_("Show this message"));
- print1opt(_("+LINE"), "", N_("Start at line number LINE"));
+ print1opt(_("+LINE,COLUMN"), "", N_("Start at line LINE, column COLUMN"));
#ifndef NANO_SMALL
print1opt("-A", "--smarthome", N_("Enable smart home key"));
print1opt("-B", "--backup", N_("Backup existing files on save"));
int main(int argc, char **argv)
{
int optchr;
- int startline = 0;
+ int startline = 1;
/* Line to try and start at. */
+ ssize_t startcol = 1;
+ /* Column to try and start at. */
#ifndef DISABLE_WRAPJUSTIFY
bool fill_flag_used = FALSE;
/* Was the fill option used? */
fprintf(stderr, "Main: open file\n");
#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 there's a +LINE or +LINE,COLUMN 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] == '+') {
+ char *comma = strchr(&argv[optind][1], ',');
+
+ if (comma != NULL)
+ parse_num(&argv[optind][comma - argv[optind] + 1],
+ &startcol);
+
startline = atoi(&argv[optind][1]);
optind++;
}
/* Read all the files after the first one on the command line into
* new buffers. */
{
- int i = optind + 1, iline = 0;
+ int i = optind + 1, iline = 1;
+ ssize_t icol = 1;
+
for (; i < argc; 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) {
+ /* If there's a +LINE or +LINE,COLUMN flag here, it is
+ * followed by at least one other argument, the filename it
+ * applies to. */
+ if (i < argc - 1 && argv[i][0] == '+' && iline == 1 &&
+ icol == 1) {
+ char *comma = strchr(&argv[i][1], ',');
+
+ if (comma != NULL)
+ parse_num(&argv[i][comma - argv[i] + 1], &icol);
+
iline = atoi(&argv[i][1]);
} else {
load_buffer(argv[i]);
- if (iline > 0) {
+
+ if (iline > 1) {
do_gotoline(iline, FALSE);
- iline = 0;
+ iline = 1;
+ }
+
+ if (icol > 1) {
+ current_x = actual_x(current->data, icol - 1);
+ icol = 1;
}
}
}
titlebar(NULL);
display_main_list();
- if (startline > 0)
+ if (startline > 1)
do_gotoline(startline, FALSE);
+ if (startcol > 1)
+ current_x = actual_x(current->data, startcol - 1);
+
#ifndef NANO_SMALL
/* Return here after a SIGWINCH. */
sigsetjmp(jmpbuf, 1);