bugGNU nano - Bugs: bug #57039, undoing an operation can...

 
 

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

bug #57039: undoing an operation can needlessly scroll the screen

Submitter:  Benno Schulenberg <bens>
Submitted:  Fri 11 Oct 2019 09:33:20 AM UTC
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed
* Mandatory Fields

Add a New Comment (Rich Markup)
   

Comment Type & Canned Response:
       

 

Sat 12 Oct 2019 09:27:32 AM UTC, comment #2: 

Fixed in git, commit 03747085.

Benno Schulenberg <bens>
Project Administrator
Fri 11 Oct 2019 01:27:14 PM UTC, comment #1: 

Attached patch avoids the unneeded scroll.  For a full-buffer operation, it puts the cursor back not just on the line but also on the row where the operation was invoked.

When the cursor has moved to a different page before the operation is undone, the behavior is different from the normal centering of the cursor.  But... maybe this behavior of restoring also the row position of the cursor should become the standard, as it is more obviously/visually an undoing of the edit.

(file #47648)

Benno Schulenberg <bens>
Project Administrator
Fri 11 Oct 2019 09:33:20 AM UTC, original submission:  

To reproduce, apply the patch from bug #55365, comment #10.  Then add at the end of your ~/.nanorc:

  extendsyntax default fixer "sed -i s/e/CCC/g"

Then run the following:

  src/nano  +$(($(stty size | cut -d' ' -f1) - 4))  README

Note that the cursor is on the center line of the screen.
Now type M-F (all "e"s get replaced), and then M-U.  Ow!  The screen scrolled, leaving the cursor on the same line of text, but now this line as at the bottom of the screen.

Undoing a full spellcheck and a full justification suffer from the same problem, but there it is less noticeable because the operations themselves caused the screen to change or scroll too.

What happens is that the full replacement of the buffer with the manipulated/spellchecked/justified text causes edittop to become invalid, thus causing it to recede to filetop.  When the cursor is close enough to the top of the file for both of them to fit on the screen, then an undo will make that happen instead of centering the screen.

When the cursor is not close to the top of the file, it will still be needlessly centered.  Run for example:

  src/nano +-1 README

The cursor is at the bottom of the screen, showing as much as possible of the tail of the file. Now type: M-F M-U.  The cursor is centered.  This is wrong.  Whenever an undo can keep the cursor on the same row (or at least in the same rough area of the screen), it should do so.

Benno Schulenberg <bens>
Project Administrator

 

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

Attach Files:
   
   
Comment:
   

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

    Date Changed by Updated Field Previous Value => Replaced by
    2019-11-30 bens Open/ClosedOpen Closed
    2019-10-12 bens StatusIn Progress Fixed
        Summaryundoing a manipulation can needlessly scroll the screen undoing an operation can needlessly scroll the screen
    2019-10-11 bens Attached File- Added store-and-restore-current-row-for-undo.patch, #47648
        StatusNone In Progress
        Assigned toNone bens

    Back to the top


    Powered by Savane 3.9