bugGNU nano - Bugs: bug #54728, the fumbling code at the start of...

 
 

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

bug #54728: the fumbling code at the start of update_undo() is misplaced

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 25 Sep 2018 03:49:24 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 25 Sep 2018 06:43:12 PM UTC, comment #4: 

Okay, I've pushed the change to master, commit 4c6ec637.

(The somewhat similar "fumbling code" at the start of add_undo() should probably be moved out too, to the relevant calls of CUT and ADD in cut.c and nano.c.  This will cause a slight duplication of code, but it will stop burdening other calls of add_undo() with something that is relevant only for ADD and CUT, and it will make the single-use keeping_cutbuffer() function superfluous.)

And closing, because not actually a bug.

Benno Schulenberg <bens>
Group administrator
Tue 25 Sep 2018 06:02:57 PM UTC, comment #3: 

What I did beforehand was: include a 'statusline(ALERT, "Creating a new undo item instead");' in that fumbling code, just before the call to add_undo().  I could trigger the message only with <Delete> and <Backspace>, not with typing or cuts or pastes or inserts.

Benno Schulenberg <bens>
Group administrator
Tue 25 Sep 2018 05:49:24 PM UTC, comment #2: 

This looks like a very good idea to me.  It removes the need to add exceptions for any more undo types that may be added in the future, and it makes the undo code somewhat less confusing by not blending undo adds with undo updates unnecessarily.

David Lawrence Ramsey <dolorous>
Group Member
Tue 25 Sep 2018 04:11:36 PM UTC, comment #1: 

Attached patch moves the code to its proper place.

(file #45095)

Benno Schulenberg <bens>
Group administrator
Tue 25 Sep 2018 03:49:24 PM UTC, original submission:  

When you do

  grep -e add_undo -e update_undo src/*.c

then you see that either 1) a call of add_undo() is paired with a call of update_undo(), or 2) there is only a call of add_undo().  Only for BACK and DEL simply update_undo() is called.

For the first two cases the fumbling code is irrelevant.  Only when pressing <Backspace> or <Delete> does update_undo() need to decide whether the preceding action was a BACK or DEL too, and if yes, that the line did not change in the meantime.  (When the position in the current line has changed between deletions, this possibilty is handled in the actual case BACK/case DEL item in update_undo().)

So... this "fumbling code" would be better placed in do_deletion(), to not burden all the other types of undo with it.

Benno Schulenberg <bens>
Group administrator

 

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

 

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 (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
    2018-09-25 bens StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2018-09-25 bens Attached File- Added 0001-undo-move-some-special-checking-code-to-the-one-plac.patch, #45095
        StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code