From ac7a071893d134ae16da993f6eadf12e1760bc11 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 28 Jun 2017 16:57:46 +0200 Subject: [PATCH] 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. --- doc/nano.1 | 6 +++++- doc/nano.texi | 8 ++++++-- src/nano.c | 10 +++++++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/doc/nano.1 b/doc/nano.1 index ba983d62..155dbb4f 100644 --- a/doc/nano.1 +++ b/doc/nano.1 @@ -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 defined in the \fInanorc\fP files. .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 Constantly show the cursor position on the status bar. 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 separately (e.g.\& 'nano \-wS \-$'). .TP -.BR \-a ", " \-b ", " \-e ", " \-f ", " \-j +.BR \-b ", " \-e ", " \-f ", " \-j Ignored, for compatibility with Pico. .SH TOGGLES diff --git a/doc/nano.texi b/doc/nano.texi index aad6b77a..aa90592e 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -246,6 +246,11 @@ should be considered as parts of words. This overrides option Specify the syntax to be used for highlighting. @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 @itemx --constantshow 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 separately (e.g.@: @code{nano -wS -$}). -@item -a -@itemx -b +@item -b @itemx -e @itemx -f @itemx -j diff --git a/src/nano.c b/src/nano.c index 63ef707b..afc36586 100644 --- a/src/nano.c +++ b/src/nano.c @@ -850,6 +850,9 @@ void usage(void) if (!ISSET(RESTRICTED)) print_opt(_("-Y "), _("--syntax="), N_("Syntax definition to use for coloring")); +#endif +#ifndef NANO_TINY + print_opt("-a", "--atblanks", N_("When soft-wrapping, do it at whitespace")); #endif print_opt("-c", "--constantshow", N_("Constantly show cursor position")); print_opt("-d", "--rebinddelete", @@ -1972,6 +1975,7 @@ int main(int argc, char **argv) {"smooth", 0, NULL, 'S'}, {"wordbounds", 0, NULL, 'W'}, {"wordchars", 1, NULL, 'X'}, + {"atblanks", 0, NULL, 'a'}, {"autoindent", 0, NULL, 'i'}, {"cut", 0, NULL, 'k'}, {"unix", 0, NULL, 'u'}, @@ -2024,7 +2028,6 @@ int main(int argc, char **argv) "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", long_options, NULL)) != -1) { switch (optchr) { - case 'a': case 'b': case 'e': case 'f': @@ -2127,6 +2130,11 @@ int main(int argc, char **argv) case 'Y': syntaxstr = mallocstrcpy(syntaxstr, optarg); break; +#endif +#ifndef NANO_TINY + case 'a': + SET(AT_BLANKS); + break; #endif case 'c': SET(CONSTANT_SHOW);