commit f4a2e7efe2af83f54fcf5b374cf564a477ac9dad
parent 027365503f7bbfd2b8d4ef0173a954f886e77203
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 17 Aug 2022 14:15:47 +0200
tweaks: move the --magic option up, so that --zero comes last
This makes that the three options that change the default layout
of the interface (--stateflags, --minibar, --zero) come last.
Also, sort the option letters into a consistent order in the code.
Diffstat:
3 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/doc/nano.1 b/doc/nano.1
@@ -317,6 +317,10 @@ Don't show the two help lines at the bottom of the screen.
.BR \-y ", " \-\-afterends
Make Ctrl+Right and Ctrl+Delete stop at word ends instead of beginnings.
.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
@@ -349,10 +353,6 @@ The status bar appears only when there is a significant message,
and disappears after 1.5 seconds or upon the next keystroke.
With \fBM\-Z\fR the title bar plus status bar can be toggled.
With \fBM\-X\fR the help lines.
-.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
Several of the above options can be switched on and off also while
diff --git a/doc/nano.texi b/doc/nano.texi
@@ -672,6 +672,11 @@ disabled to display the help-system navigation keys.
Make @kbd{Ctrl+Right} and @kbd{Ctrl+Delete} stop at word ends
instead of beginnings.
+@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:
@@ -708,11 +713,6 @@ and disappears after 1.5 seconds or upon the next keystroke.
With @kbd{M-Z} the title bar plus status bar can be toggled.
With @kbd{M-X} the help lines.
-@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
Option @code{-z} (@code{--suspendable}) has been removed.
diff --git a/src/nano.c b/src/nano.c
@@ -651,13 +651,15 @@ void usage(void)
print_opt("-x", "--nohelp", N_("Don't show the two help lines"));
#ifndef NANO_TINY
print_opt("-y", "--afterends", N_("Make Ctrl+Right stop at word ends"));
- print_opt("-%", "--stateflags", N_("Show some states on the title bar"));
- print_opt("-_", "--minibar", N_("Show a feedback bar at the bottom"));
- print_opt("-0", "--zero", N_("Hide all bars, use whole terminal"));
#endif
#ifdef HAVE_LIBMAGIC
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("-_", "--minibar", N_("Show a feedback bar at the bottom"));
+ print_opt("-0", "--zero", N_("Hide all bars, use whole terminal"));
+#endif
}
/* Display the version number of this nano, a copyright notice, some contact
@@ -1820,8 +1822,8 @@ int main(int argc, char **argv)
if (*(tail(argv[0])) == 'r')
SET(RESTRICTED);
- while ((optchr = getopt_long(argc, argv, "0ABC:DEFGHIJ:KLMNOPQ:RST:UVWX:Y:Z"
- "abcdef:ghijklmno:pqr:s:tuvwxy$%_!", long_options, NULL)) != -1) {
+ while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNOPQ:RS$T:UVWX:Y:Z"
+ "abcdef:ghijklmno:pqr:s:tuvwxy!%_0", long_options, NULL)) != -1) {
switch (optchr) {
#ifndef NANO_TINY
case 'A':
@@ -2053,6 +2055,13 @@ int main(int argc, char **argv)
case 'y':
SET(AFTER_ENDS);
break;
+#endif
+#ifdef HAVE_LIBMAGIC
+ case '!':
+ SET(USE_MAGIC);
+ break;
+#endif
+#ifndef NANO_TINY
case '%':
SET(STATEFLAGS);
break;
@@ -2063,11 +2072,6 @@ int main(int argc, char **argv)
SET(ZERO);
break;
#endif
-#ifdef HAVE_LIBMAGIC
- case '!':
- SET(USE_MAGIC);
- break;
-#endif
default:
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
exit(1);