commit 7d3aad403d5a5b660f13096f55edfe6fc85a4cdd
parent aa70f3d95e8f4f7138388f5b8c0f8c77809c6035
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Fri, 27 Mar 2020 16:57:25 +0100
options: make -S the short synonym of --softwrap
The form -$ is still accepted, but is deprecated.
Diffstat:
3 files changed, 25 insertions(+), 30 deletions(-)
diff --git a/doc/nano.1 b/doc/nano.1
@@ -175,6 +175,12 @@ different name if it already has one; and don't make backup files.
Restricted mode can also be activated by invoking \fBnano\fP
with any name beginning with 'r' (e.g. "rnano").
.TP
+.BR \-S ", " \-\-softwrap
+Display over multiple screen rows lines that exceed the screen's width.
+(You can make this soft-wrapping occur at whitespace instead of rudely at
+the screen's edge, by using also \fB\-\-atblanks\fR.)
+(The old short option, \fB\-$\fR, is deprecated.)
+.TP
.BR \-T\ \fInumber ", " \-\-tabsize= \fInumber
Set the size (width) of a tab to \fInumber\fP columns. The value of
\fInumber\fP must be greater than 0. The default value is 8.
@@ -312,15 +318,6 @@ Make Ctrl+Right stop at word ends instead of beginnings.
.TP
.BR \-z ", " \-\-suspendable
Allow the user to suspend the editor (with \fB^Z\fR by default).
-.TP
-.BR \-$ ", " \-\-softwrap
-Display lines that exceed the screen's width over multiple screen lines.
-(You can make this soft-wrapping occur at whitespace instead of rudely at
-the screen's edge, by using also \fB\-\-atblanks\fR.)
-Since
-\&'$' normally refers to a variable in the Unix shell, you should specify
-this option last when using other options (e.g.\& 'nano \-wS$') or pass it
-separately (e.g.\& 'nano \-wS \-$').
.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
@@ -262,6 +262,13 @@ name if it already has one; and don't make backup files.
Restricted mode can also be activated by invoking @command{nano} with
any name beginning with @code{r} (e.g.@: @command{rnano}).
+@item -S
+@itemx --softwrap
+Display over multiple screen rows lines that exceed the screen's width.
+(You can make this soft-wrapping occur at whitespace instead of rudely at
+the screen's edge, by using also @code{--atblanks}.)
+(The old short option, @code{-$}, is deprecated.)
+
@item -T @var{number}
@itemx --tabsize=@var{number}
Set the displayed tab length to @var{number} columns. The value of
@@ -448,16 +455,6 @@ Make Ctrl+Right stop at word ends instead of beginnings.
Enable the ability to suspend @command{nano} using the system's suspend
keystroke (usually @kbd{^Z}).
-@item -$
-@itemx --softwrap
-Display lines that exceed the screen's width over multiple screen lines.
-(You can make this soft-wrapping occur at whitespace instead of rudely at
-the screen's edge, by using also @code{--atblanks}.)
-Since
-@code{$} normally refers to a variable in the Unix shell, you should specify
-this option last when using other options (e.g.@: @code{nano -wS$}) or pass it
-separately (e.g.@: @code{nano -wS -$}).
-
@end table
@@ -661,7 +658,7 @@ The following global toggles are available:
@kbd{Meta-P} toggles the displaying of whitespace (@pxref{Whitespace}).
@item Soft Wrapping
-@kbd{Meta-S} toggles the @option{-$} (@option{--softwrap}) command-line option.
+@kbd{Meta-S} toggles the @option{-S} (@option{--softwrap}) command-line option.
@item Expert/No Help
@kbd{Meta-X} toggles the @option{-x} (@option{--nohelp}) command-line option.
diff --git a/src/nano.c b/src/nano.c
@@ -594,6 +594,9 @@ void usage(void)
#endif
if (!ISSET(RESTRICTED))
print_opt("-R", "--restricted", N_("Restrict access to the filesystem"));
+#ifndef NANO_TINY
+ print_opt("-S", "--softwrap", N_("Display overlong lines on multiple rows"));
+#endif
print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"),
N_("Set width of a tab to #cols columns"));
print_opt("-U", "--quickblank", N_("Wipe status bar upon next keystroke"));
@@ -670,9 +673,6 @@ void usage(void)
#endif
if (!ISSET(RESTRICTED))
print_opt("-z", "--suspendable", N_("Enable suspension"));
-#ifndef NANO_TINY
- print_opt("-$", "--softwrap", N_("Display overlong lines on multiple rows"));
-#endif
}
/* Display the current version of nano, the date and time it was
@@ -1817,6 +1817,7 @@ int main(int argc, char **argv)
{"nonewlines", 0, NULL, 'L'},
{"noconvert", 0, NULL, 'N'},
{"positionlog", 0, NULL, 'P'},
+ {"softwrap", 0, NULL, 'S'},
{"wordbounds", 0, NULL, 'W'},
{"wordchars", 1, NULL, 'X'},
{"zap", 0, NULL, 'Z'},
@@ -1825,7 +1826,6 @@ int main(int argc, char **argv)
{"cutfromcursor", 0, NULL, 'k'},
{"unix", 0, NULL, 'u'},
{"afterends", 0, NULL, 'y'},
- {"softwrap", 0, NULL, '$'},
#endif
{NULL, 0, NULL, 0}
};
@@ -1881,7 +1881,7 @@ int main(int argc, char **argv)
if (*(tail(argv[0])) == 'r')
SET(RESTRICTED);
- while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNPQ:RT:UVWX:Y:Z"
+ while ((optchr = getopt_long(argc, argv, "ABC:DEFGHIJ:KLMNPQ:RST:UVWX:Y:Z"
"abcdef:ghijklmno:pr:s:tuvwxyz$", long_options, NULL)) != -1) {
switch (optchr) {
#ifndef NANO_TINY
@@ -1963,6 +1963,12 @@ int main(int argc, char **argv)
case 'R':
SET(RESTRICTED);
break;
+#ifndef NANO_TINY
+ case 'S':
+ case '$': /* Deprecated; remove in 2024. */
+ SET(SOFTWRAP);
+ break;
+#endif
case 'T':
if (!parse_num(optarg, &tabsize) || tabsize <= 0) {
fprintf(stderr, _("Requested tab size \"%s\" is invalid"), optarg);
@@ -2102,11 +2108,6 @@ int main(int argc, char **argv)
case 'z':
SET(SUSPENDABLE);
break;
-#ifndef NANO_TINY
- case '$':
- SET(SOFTWRAP);
- break;
-#endif
default:
printf(_("Type '%s -h' for a list of available options.\n"), argv[0]);
exit(1);