bugGNU nano - Bugs: bug #53387, reading a file into a new buffer...

 
 

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

bug #53387: reading a file into a new buffer should not be undoable

Submitter:  Benno Schulenberg <bens>
Submitted:  Mon 19 Mar 2018 08:21:54 PM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 20 Mar 2018 10:24:08 AM UTC, comment #3: 

Thanks for testing.  I've applied a more conservative patch: commit a1132c81.

(I think that 'undoable' and 'new_buffer' should always be the inverse of each other, but I'm not entirely sure.  That thought made me run into this problem in the first place.)

Benno Schulenberg <bens>
Group administrator
Mon 19 Mar 2018 08:57:52 PM UTC, comment #2: 

If we assume that undo operations apply only to the current buffer, your idea makes perfect sense.

(If that assumption wasn't the case, trying to undo reading a file into a new buffer wouldn't just undo the insert, it'd undo the creation of the new buffer where the insert took place, and that's a lot more complex.  Since inserting a file into another buffer doesn't change the current buffer, I don't think going that far is worth the effort.)

Your patch does seem to work properly so far, after some quick testing.  The testing scenario you describe works properly.  I also tried  running nano --multi NEWS and trying to undo that first buffer insert, as well as running nano --multi NEWS, inserting README into a new buffer, inserting README.GIT into the same buffer as README, successfully undoing the insert of README.GIT, and then trying to undo the insert of README.  After both of these, nano replied with "Nothing in undo buffer!", as expected.

David Lawrence Ramsey <dolorous>
Group Member
Mon 19 Mar 2018 08:34:11 PM UTC, comment #1: 

David, can you have a look at this?  To see whether you agree with what I describe as the expected behavior.  And whether the patch does not have any undesired side effects.

(file #43596)

Benno Schulenberg <bens>
Group administrator
Mon 19 Mar 2018 08:21:54 PM UTC, original submission:  

To reproduce, run:

  src/nano --multi NEWS

Then type: ^R README <Enter>.
This opens the README file in a second buffer.

Now type: M-U.
It says: "[ Undid action (text insert) ]"

What!?  Well, it would still be kind of acceptable if it would mark the file as Modified.  But now it seems as if the README file is entirely empty.  One can now exit immediately with ^X.  But if one has the habit of doing ^S ^X, then the README file has been wiped clean.  Weird!

Expected behavior: when reading a file into a new buffer, this should not be undoable, just like when the file was mentioned on the command line.

Benno Schulenberg <bens>
Group administrator

 

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

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 dolorous (Posted a comment)
  • -email is unavailable- added by bens
  • -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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-03-30 bens Open/ClosedOpen Closed
    2018-03-20 bens StatusIn Progress Fixed
    2018-03-19 bens Attached File- Added dont-allow-undoing-a-new-buffer.patch, #43596
        Carbon-Copy- Added dolorous
    2018-03-19 bens Summaryundoing the opening of a second file does not mark it as Modified reading a file into a new buffer should not be undoable

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code