bugGNU nano - Bugs: bug #57808, undoing a paste or insert on the...

 
 

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

bug #57808: undoing a paste or insert on the bottom line does not remove the extra newline

Submitter:  Benno Schulenberg <bens>
Submitted:  Thu 13 Feb 2020 06:28:49 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 14 Feb 2020 02:54:13 PM UTC, comment #3: 

Fixed in git, commit a0506a15.

(When redoing a paste -- through undo_cut() -- there must be an extra check to prevent removing an actually needed magic line.)

Benno Schulenberg <bens>
Group administrator
Fri 14 Feb 2020 10:23:05 AM UTC, comment #2: 

Inserting a file that does not end in a newline has the same problem: the insertion at the bottom of the buffer adds a magic line, but the undo does not remove it.

Compare this with typing a few characters into an empty buffer, and then undoing it.  Typing the first character adds a magic line, and the undo removes it.  That's how it should be.

Benno Schulenberg <bens>
Group administrator
Thu 13 Feb 2020 06:39:30 PM UTC, comment #1: 

The bug exists in this form since at least version 2.5.0.  From version 2.3.3 to 2.4.3 the extra line is not removed either, but at least the character count is correct: it has increased by 1 to 2990.

(Version 2.3.0 to 2.3.2 I don't have available at the moment, and version 2.2.6 reports "Internal error: can't setup uncut" upon the ^U.)

Benno Schulenberg <bens>
Group administrator
Thu 13 Feb 2020 06:28:49 PM UTC, original submission:  

To reproduce, run:


src/nano --ignore +4 README


Then type: ^6 ^E M-6 M-/ ^C
Note that there are 80 lines in the buffer, and 2989 characters.

Now type: ^U M-U ^C
See that now there are 81 lines in the buffer, and still 2989 characters.  This is not possible.  Type ^N.  The cursor goes one line down.  There is an extra line in the buffer, but the character count did not increase.

Expected behavior: when a paste of some characters (without a newline) onto the bottom line is undone, also the magic line that was added should be removed. (For the above case: there should be just 80 lines after the M-U, the ^N should do nothing, and 2989 characters is correct.)

To compare: when the paste does contain a newline (for example, when leaving out the ^6 ^E in the above recipe), then things work correctly.

Benno Schulenberg <bens>
Group administrator

 

(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 (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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-03-25 bens Open/ClosedOpen Closed
    2020-02-14 bens StatusNone Fixed
    2020-02-14 bens Assigned toNone bens
        Summaryundoing a paste on the bottom line does not remove the extra newline undoing a paste or insert on the bottom line does not remove the extra newline

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code