options: move --stateflags (-%) and --magic (-!) to the end of the list

It's nicer to start the list with -A, -B, -C.  And, when the user
does 'nano --help', these new flags are more likely to be noticed.
master
Benno Schulenberg 2020-10-01 11:18:45 +02:00
parent 5bd92d4c60
commit 072c8aa39b
3 changed files with 49 additions and 45 deletions

View File

@ -95,18 +95,6 @@ The default key bindings can be changed via a \fInanorc\fR file -- see
.SH OPTIONS .SH OPTIONS
.TP .TP
.BR \-! ", " \-\-magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
.TP
.BR \-% ", " \-\-stateflags
Use the top-right corner of the screen for showing some state flags:
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when
hard-wrapping (breaking long lines), \fBR\fR when recording a macro,
and \fBS\fR when soft-wrapping.
When the buffer is modified, a star (\fB*\fR) is shown after the
filename in the center of the title bar.
.TP
.BR \-A ", " \-\-smarthome .BR \-A ", " \-\-smarthome
Make the Home key smarter. When Home is pressed anywhere but at the Make the Home key smarter. When Home is pressed anywhere but at the
very beginning of non-whitespace characters on a line, the cursor will very beginning of non-whitespace characters on a line, the cursor will
@ -340,6 +328,18 @@ Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
.TP .TP
.BR \-z ", " \-\-suspendable .BR \-z ", " \-\-suspendable
Allow the user to suspend the editor (with \fB^Z\fR by default). Allow the user to suspend the editor (with \fB^Z\fR by default).
.TP
.BR \-% ", " \-\-stateflags
Use the top-right corner of the screen for showing some state flags:
\fBI\fR when auto-indenting, \fBM\fR when the mark is on, \fBL\fR when
hard-wrapping (breaking long lines), \fBR\fR when recording a macro,
and \fBS\fR when soft-wrapping.
When the buffer is modified, a star (\fB*\fR) is shown after the
filename in the center of the title bar.
.TP
.BR \-! ", " \-\-magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
.SH TOGGLES .SH TOGGLES
Several of the above options can be switched on and off also while Several of the above options can be switched on and off also while

View File

@ -165,20 +165,6 @@ a command straight into a buffer, and then edit it.
@table @option @table @option
@item -!
@itemx --magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
@item -%
@itemx --stateflags
Use the top-right corner of the screen for showing some state flags:
@code{I} when auto-indenting, @code{M} when the mark is on, @code{L} when
hard-wrapping (breaking long lines), @code{R} when recording a macro,
and @code{S} when soft-wrapping.
When the buffer is modified, a star (@code{*}) is shown after the
filename in the center of the title bar.
@item -A @item -A
@itemx --smarthome @itemx --smarthome
Make the Home key smarter. When Home is pressed anywhere but at the Make the Home key smarter. When Home is pressed anywhere but at the
@ -482,6 +468,20 @@ Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
Enable the ability to suspend @command{nano} using the system's suspend Enable the ability to suspend @command{nano} using the system's suspend
keystroke (usually @kbd{^Z}). keystroke (usually @kbd{^Z}).
@item -%
@itemx --stateflags
Use the top-right corner of the screen for showing some state flags:
@code{I} when auto-indenting, @code{M} when the mark is on, @code{L} when
hard-wrapping (breaking long lines), @code{R} when recording a macro,
and @code{S} when soft-wrapping.
When the buffer is modified, a star (@code{*}) is shown after the
filename in the center of the title bar.
@item -!
@itemx --magic
When neither the file's name nor its first line give a clue,
try using libmagic to determine the applicable syntax.
@end table @end table

View File

@ -494,13 +494,9 @@ void usage(void)
#endif #endif
/* TRANSLATORS: The next three are column headers of the --help output. */ /* TRANSLATORS: The next three are column headers of the --help output. */
print_opt(_("Option"), _("Long option"), N_("Meaning")); print_opt(_("Option"), _("Long option"), N_("Meaning"));
#ifdef HAVE_LIBMAGIC #ifndef NANO_TINY
/* TRANSLATORS: The next forty or so strings are option descriptions /* TRANSLATORS: The next forty or so strings are option descriptions
* for the --help output. Try to keep them at most 40 characters. */ * for the --help output. Try to keep them at most 40 characters. */
print_opt("-!", "--magic", N_("Also try magic to determine syntax"));
#endif
#ifndef NANO_TINY
print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
print_opt("-A", "--smarthome", N_("Enable smart home key")); print_opt("-A", "--smarthome", N_("Enable smart home key"));
if (!ISSET(RESTRICTED)) { if (!ISSET(RESTRICTED)) {
print_opt("-B", "--backup", N_("Save backups of existing files")); print_opt("-B", "--backup", N_("Save backups of existing files"));
@ -647,6 +643,12 @@ void usage(void)
#endif #endif
if (!ISSET(RESTRICTED)) if (!ISSET(RESTRICTED))
print_opt("-z", "--suspendable", N_("Enable suspension")); print_opt("-z", "--suspendable", N_("Enable suspension"));
#ifndef NANO_TINY
print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
#endif
#ifdef HAVE_LIBMAGIC
print_opt("-!", "--magic", N_("Also try magic to determine syntax"));
#endif
} }
/* Display the version number of this nano, a copyright notice, some contact /* Display the version number of this nano, a copyright notice, some contact
@ -1706,9 +1708,6 @@ int main(int argc, char **argv)
/* Whether the quoting regex was compiled successfully. */ /* Whether the quoting regex was compiled successfully. */
#endif #endif
const struct option long_options[] = { const struct option long_options[] = {
#ifdef HAVE_LIBMAGIC
{"magic", 0, NULL, '!'},
#endif
{"boldtext", 0, NULL, 'D'}, {"boldtext", 0, NULL, 'D'},
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
{"multibuffer", 0, NULL, 'F'}, {"multibuffer", 0, NULL, 'F'},
@ -1769,7 +1768,6 @@ int main(int argc, char **argv)
{"nohelp", 0, NULL, 'x'}, {"nohelp", 0, NULL, 'x'},
{"suspendable", 0, NULL, 'z'}, {"suspendable", 0, NULL, 'z'},
#ifndef NANO_TINY #ifndef NANO_TINY
{"stateflags", 0, NULL, '%'},
{"smarthome", 0, NULL, 'A'}, {"smarthome", 0, NULL, 'A'},
{"backup", 0, NULL, 'B'}, {"backup", 0, NULL, 'B'},
{"backupdir", 1, NULL, 'C'}, {"backupdir", 1, NULL, 'C'},
@ -1794,6 +1792,10 @@ int main(int argc, char **argv)
{"indicator", 0, NULL, 'q'}, {"indicator", 0, NULL, 'q'},
{"unix", 0, NULL, 'u'}, {"unix", 0, NULL, 'u'},
{"afterends", 0, NULL, 'y'}, {"afterends", 0, NULL, 'y'},
{"stateflags", 0, NULL, '%'},
#endif
#ifdef HAVE_LIBMAGIC
{"magic", 0, NULL, '!'},
#endif #endif
{NULL, 0, NULL, 0} {NULL, 0, NULL, 0}
}; };
@ -1849,18 +1851,10 @@ int main(int argc, char **argv)
if (*(tail(argv[0])) == 'r') if (*(tail(argv[0])) == 'r')
SET(RESTRICTED); SET(RESTRICTED);
while ((optchr = getopt_long(argc, argv, "!%ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z" while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
"abcdef:ghijklmno:pqr:s:tuvwxyz$?", long_options, NULL)) != -1) { "abcdef:ghijklmno:pqr:s:tuvwxyz$?%!", long_options, NULL)) != -1) {
switch (optchr) { switch (optchr) {
#ifdef HAVE_LIBMAGIC
case '!':
SET(USE_MAGIC);
break;
#endif
#ifndef NANO_TINY #ifndef NANO_TINY
case '%':
SET(STATEFLAGS);
break;
case 'A': case 'A':
SET(SMART_HOME); SET(SMART_HOME);
break; break;
@ -2097,6 +2091,16 @@ int main(int argc, char **argv)
case 'z': case 'z':
SET(SUSPENDABLE); SET(SUSPENDABLE);
break; break;
#ifndef NANO_TINY
case '%':
SET(STATEFLAGS);
break;
#endif
#ifdef HAVE_LIBMAGIC
case '!':
SET(USE_MAGIC);
break;
#endif
default: default:
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]); printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
exit(1); exit(1);