options: recognize -a and --atblanks on the command line

In nano, -a is only effective when also -$ is given, so this will
not conflict with Pico since Pico does not know the -$ option.
master
Benno Schulenberg 2017-06-28 16:57:46 +02:00
parent 09723b07a8
commit ac7a071893
3 changed files with 20 additions and 4 deletions

View File

@ -164,6 +164,10 @@ should be considered as part of a word. This overrides option
Specify the name of the syntax highlighting to use from among the ones Specify the name of the syntax highlighting to use from among the ones
defined in the \fInanorc\fP files. defined in the \fInanorc\fP files.
.TP .TP
.BR \-a ", " \-\-atblanks
When doing soft line wrapping, wrap lines at whitespace
instead of always at the edge of the screen.
.TP
.BR \-c ", " \-\-constantshow .BR \-c ", " \-\-constantshow
Constantly show the cursor position on the status bar. Constantly show the cursor position on the status bar.
Note that this overrides option \fB\-U\fR (\fB\-\-quickblank\fR). Note that this overrides option \fB\-U\fR (\fB\-\-quickblank\fR).
@ -256,7 +260,7 @@ continuing it over multiple screen lines. Since
this option last when using other options (e.g.\& 'nano \-wS$') or pass it this option last when using other options (e.g.\& 'nano \-wS$') or pass it
separately (e.g.\& 'nano \-wS \-$'). separately (e.g.\& 'nano \-wS \-$').
.TP .TP
.BR \-a ", " \-b ", " \-e ", " \-f ", " \-j .BR \-b ", " \-e ", " \-f ", " \-j
Ignored, for compatibility with Pico. Ignored, for compatibility with Pico.
.SH TOGGLES .SH TOGGLES

View File

@ -246,6 +246,11 @@ should be considered as parts of words. This overrides option
Specify the syntax to be used for highlighting. Specify the syntax to be used for highlighting.
@xref{Syntax Highlighting} for more info. @xref{Syntax Highlighting} for more info.
@item -a
@itemx --atblanks
When doing soft line wrapping, wrap lines at whitespace
instead of always at the edge of the screen.
@item -c @item -c
@itemx --constantshow @itemx --constantshow
Constantly display the cursor position (line number, column number, Constantly display the cursor position (line number, column number,
@ -375,8 +380,7 @@ continuing it over multiple screen lines. Since
this option last when using other options (e.g.@: @code{nano -wS$}) or pass it this option last when using other options (e.g.@: @code{nano -wS$}) or pass it
separately (e.g.@: @code{nano -wS -$}). separately (e.g.@: @code{nano -wS -$}).
@item -a @item -b
@itemx -b
@itemx -e @itemx -e
@itemx -f @itemx -f
@itemx -j @itemx -j

View File

@ -850,6 +850,9 @@ void usage(void)
if (!ISSET(RESTRICTED)) if (!ISSET(RESTRICTED))
print_opt(_("-Y <name>"), _("--syntax=<name>"), print_opt(_("-Y <name>"), _("--syntax=<name>"),
N_("Syntax definition to use for coloring")); N_("Syntax definition to use for coloring"));
#endif
#ifndef NANO_TINY
print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at whitespace"));
#endif #endif
print_opt("-c", "--constantshow", N_("Constantly show cursor position")); print_opt("-c", "--constantshow", N_("Constantly show cursor position"));
print_opt("-d", "--rebinddelete", print_opt("-d", "--rebinddelete",
@ -1972,6 +1975,7 @@ int main(int argc, char **argv)
{"smooth", 0, NULL, 'S'}, {"smooth", 0, NULL, 'S'},
{"wordbounds", 0, NULL, 'W'}, {"wordbounds", 0, NULL, 'W'},
{"wordchars", 1, NULL, 'X'}, {"wordchars", 1, NULL, 'X'},
{"atblanks", 0, NULL, 'a'},
{"autoindent", 0, NULL, 'i'}, {"autoindent", 0, NULL, 'i'},
{"cut", 0, NULL, 'k'}, {"cut", 0, NULL, 'k'},
{"unix", 0, NULL, 'u'}, {"unix", 0, NULL, 'u'},
@ -2024,7 +2028,6 @@ int main(int argc, char **argv)
"ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$",
long_options, NULL)) != -1) { long_options, NULL)) != -1) {
switch (optchr) { switch (optchr) {
case 'a':
case 'b': case 'b':
case 'e': case 'e':
case 'f': case 'f':
@ -2127,6 +2130,11 @@ int main(int argc, char **argv)
case 'Y': case 'Y':
syntaxstr = mallocstrcpy(syntaxstr, optarg); syntaxstr = mallocstrcpy(syntaxstr, optarg);
break; break;
#endif
#ifndef NANO_TINY
case 'a':
SET(AT_BLANKS);
break;
#endif #endif
case 'c': case 'c':
SET(CONSTANT_SHOW); SET(CONSTANT_SHOW);