From cb56a575fdcb8040bac2d12f4d3be3b710cadbd8 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Tue, 23 Jan 2018 13:44:03 +0100 Subject: [PATCH] options: recognize -M and --trimblanks on the command line --- doc/nano.1 | 4 ++++ doc/nano.texi | 5 +++++ src/nano.c | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/nano.1 b/doc/nano.1 index 96e9cdf0..ae0da16d 100644 --- a/doc/nano.1 +++ b/doc/nano.1 @@ -108,6 +108,10 @@ won't work properly with this option enabled. .BR \-L ", " \-\-nonewlines Don't add newlines to the ends of files. .TP +.BR \-M ", " \-\-trimblanks +Snip trailing whitespace from the wrapped line when automatic +hard-wrapping occurs or when text is justified. +.TP .BR \-N ", " \-\-noconvert Disable automatic conversion of files from DOS/Mac format. .TP diff --git a/doc/nano.texi b/doc/nano.texi index 8a44dfaf..ea4eb90c 100644 --- a/doc/nano.texi +++ b/doc/nano.texi @@ -200,6 +200,11 @@ won't work properly with this option enabled. @itemx --nonewlines Don't add newlines to the ends of files. +@item -M +@itemx --trimblanks +Snip trailing whitespace from the wrapped line when automatic +hard-wrapping occurs or when text is justified. + @item -N @itemx --noconvert Disable automatic conversion of files from DOS/Mac format. diff --git a/src/nano.c b/src/nano.c index a21625cf..e2bdf5d7 100644 --- a/src/nano.c +++ b/src/nano.c @@ -818,6 +818,8 @@ void usage(void) N_("Fix numeric keypad key confusion problem")); print_opt("-L", "--nonewlines", N_("Don't add newlines to the ends of files")); + print_opt("-M", "--trimblanks", + N_("Trim tail spaces when hard-wrapping")); #ifndef NANO_TINY print_opt("-N", "--noconvert", N_("Don't convert files from DOS/Mac format")); @@ -2031,7 +2033,7 @@ int main(int argc, char **argv) while ((optchr = getopt_long(argc, argv, - "ABC:DEFGHIKLNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", + "ABC:DEFGHIKLMNOPQ:RST:UVWX:Y:abcdefghijklmno:pqr:s:tuvwxz$", long_options, NULL)) != -1) { switch (optchr) { case 'b': @@ -2085,6 +2087,9 @@ int main(int argc, char **argv) case 'L': SET(NO_NEWLINES); break; + case 'M': + SET(TRIM_BLANKS); + break; #ifndef NANO_TINY case 'N': SET(NO_CONVERT);