bugGNU nano - Bugs: bug #62450, [Wish] add an option to autotrim...


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

bug #62450: [Wish] add an option to autotrim trailing new lines

Submitter:  Sch <cyq>
Submitted:  Fri 13 May 2022 09:41:20 AM UTC
Severity:  1 - Wish Status:  Wont Fix
Assigned to:  None Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)

Comment Type & Canned Response:


Fri 13 May 2022 03:44:51 PM UTC, comment #2: 

You can make this yourself with a wrapper script: let the script trim any trailing newlines after the real nano exits.

Or you could apply the attached patch to your private nano and have nano always trim trailing newlines.

It's too small a thing to add an option for, and it cannot be the standard behavior -- not all people will want it.

(file #53195)

Benno Schulenberg <bens>
Project Administrator
Fri 13 May 2022 09:49:33 AM UTC, comment #1: 

This following crosstable describes the behaviour I'm imagining:

| # of trailing newlines | set autotrimtrailingnewlines | unset autotrimtrailingnewlines |
| set nonewlines         | always 0                     | don't care                     |
| unset nonewlines       | always 1                     | at least 1                     |

Sch <cyq>
Fri 13 May 2022 09:41:20 AM UTC, original submission:  

Oftentimes during editing we accidentally add extraneous new lines to the end of my file.

In most if not all situations that I know of, there's no reason to keep those trailing linebreaks. So I think it would be a good quality-of-life improvement to have an option in `nanorc`, something like `set autotrimtrailingnewlines`. It should also work well with `set nonewlines` without too much trouble.

Sch <cyq>


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

Attach Files:

Attached Files


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by bens (Updated the item)
  • -email is unavailable- added by cyq (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.

    Only logged-in users can vote.





    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-05-30 bens Open/ClosedOpen Closed
        Summary[Wish] add option to autotrim trailing new lines [Wish] add an option to autotrim trailing new lines
    2022-05-13 bens Attached File- Added trim-trailing-newlines-when-saving.patch, #53195
        Severity3 - Normal 1 - Wish
        StatusNone Wont Fix

    Back to the top

    Powered by Savane 3.9