bugGNU nano - Bugs: bug #63057, Trim blanks option doesn't work...


You are not allowed to post comments on this tracker with your current authentication level.

bug #63057: Trim blanks option doesn't work correctly

Submitter:  Oliver <compiler>
Submitted:  Wed 14 Sep 2022 03:54:10 PM UTC
Severity:  3 - Normal Status:  Invalid
Assigned to:  None Open/Closed:  Closed

Discussion locked!

Thu 15 Sep 2022 11:03:12 AM UTC, comment #3: 

Option names are concise.  They cannot express the details.  Users should read the manual -- especially before thinking of reporting a bug.

Benno Schulenberg <bens>
Project Administrator
Thu 15 Sep 2022 08:42:48 AM UTC, comment #2: 

Well, in this case, the name of the "trimblanks" option is misleading and nano lacks a feature to automatically remove trailing blanks.

Blanks at the end of a line are of no usage in most cases, with the exception of tables. Theoretically they waste space, and they do in practice waste space if the text does not fit into the last sector because of the blanks.
And if the data gets transmitted or zipped they increase the size of data.

Oliver <compiler>
Thu 15 Sep 2022 06:49:10 AM UTC, comment #1: 

From `man nanorc`:

  set trimblanks
    Remove trailing whitespace from wrapped lines when automatic
    hard-wrapping occurs or when text is justified.

Read carefully: trailing whitespace is removed

  • from wrapped lines
  • when automatic hard-wrapping occurs or
  • when text is justified.

At no other time or place is whitespace removed.  And certainly not when the buffer is saved: when pressing ^S or ^O^M, nano saves the buffer as-is and makes no modifications.

Benno Schulenberg <bens>
Project Administrator
Wed 14 Sep 2022 03:54:10 PM UTC, original submission:  

Blanks at line ending are not removed automatically, when the
trim blank configuration option is set in ~/.config/nano/nanorc

Steps to reproduce:
1. Open ~/.config/nano/nanorc and set the two options "set trimblanks" and "set autoindent" if not done already.
2. Save the config and open a new file with nano.
3. Indent n spaces and write something. You can use for n for example 4 spaces. Then write a word and press enter.
4. Because "set autoindent" is active the cursor will be positioned n spaces in the line.
5. Now here comes the important part. In the new second line, write a word and press enter.
6. You will now reach the third line after pressing enter. Write a word again.
7. Now go back to the second line and delete only the characters
of the word, but not the n spaces in front of them. And do not press enter.
8. Save the file and exit nano.
9. Open the file again and go to the second line, which should be empty now because of "set timblanks" option, but it is not. The n spaces do still exist because they got not deleted by trimblanks as they should.

Oliver <compiler>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bens (Posted a comment)
  • -email is unavailable- added by compiler (Submitted the item)

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.




    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-30 bens Open/ClosedOpen Closed
    2022-09-15 bens Discussion LockUnlocked Locked
    2022-09-15 bens StatusNone Invalid

    Back to the top

    Powered by Savane 3.9