#1087171 nano: 'set trimblanks' does not always trim trailing white space.

Package:
nano
Source:
nano
Description:
small, friendly text editor inspired by Pico
Submitter:
Martin-Éric Racine
Date:
2024-11-09 13:15:01 UTC
Severity:
normal
Tags:
#1087171#5
Date:
2024-11-09 10:17:18 UTC
From:
To:
I have 'set trimblanks' in .nanorc and yet, most of the time, files get saved with some trailing whitespace remaining.

Setting the option really should trim at all times, prior to saving a file. Right now, it seemingly only trims following a justify command within the editor.

Martin-Éric

#1087171#10
Date:
2024-11-09 11:56:17 UTC
From:
To:
Op 09-11-2024 om 11:17 schreef Martin-Éric Racine:

One could argue that the option is poorly named, but... users should
really read the documentation.  For trimblanks, `man nanorc` says:
"Snip trailing whitespace from the wrapped line _when_ automatic
hard-wrapping occurs or _when_ text is justified."

You can arrange the trimming of all trailing whitespace yourself.
Search for "snipping" in the sample nanorc:

   grep -A1 snipping /usr/share/doc/nano/examples/sample.nanorc

That gives:

   ## For snipping trailing blanks when you save a file:
   # bind ^S "{execute}| sed 's/\s\+$//' {enter}{savefile}" main


Benno

#1087171#19
Date:
2024-11-09 13:12:10 UTC
From:
To:
la 9. marrask. 2024 klo 13.56 Benno Schulenberg (bensberg@telfort.nl) kirjoitti:

Poorly named is an understatement, since this actually is conditional
to actions within the editor.

Which really isn't quite the same.  This now requires using an
entirely different keystroke than the usual save action.

Martin-Éric