bugGNU nano - Bugs: bug #51407, indenting and unindenting via M-}...

 
 

bug #51407: indenting and unindenting via M-} and M-{ doesn't preserve the vertical cursor position

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Fri 07 Jul 2017 05:32:20 AM UTC  
 
Severity: 3 - NormalStatus: Fixed
Assigned to: David Lawrence Ramsey <dolorous>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Fri 07 Jul 2017 10:27:15 AM UTC, comment #1:

Fixed in git, 5bc4abee. Thanks for the patch.

Benno Schulenberg <bens>
Project Administrator
Fri 07 Jul 2017 05:32:20 AM UTC, original submission:

This can be reproduced as follows. For indenting:

1. Start nano with the attached file linetest.txt:

./nano --ignore linetest.txt

2. Press Meta-} to indent the first line. The line should be indented by a tab, and the cursor should move forward a tab's worth of columns accordingly.

3. Press Down. The cursor will move to the second line, but its vertical position will change to the beginning of the line instead of staying where it was vertically on the first line.

(This is caused by nano's not updating placewewant when it adds indentation to the line.)

4. Press Meta-} to indent the second line.

5. Press Right, then press Left to ensure that placewewant is up to date for the next step: after the tab added to the second line.

6. Press Meta-{ to unindent the second line. The line should lose its tab, and the cursor should move back to the beginning of the line.

7. Press Up. The cursor will move to the first line, but its vertical position will change to after the tab on the first line instead of staying where it was vertically on the second line.

(This is caused by nano's not updating placewewant when it removes indentation from the line.)

The attached patch fixes both of these issues. The fix is modeled after similar code in do_comment(), since that function also does bulk updates of lines including the current line.

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by bens (Posted a comment)
  • -unavailable- added by dolorous (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 22 Jul 2017 07:14:41 PM UTCbensOpen/ClosedOpen=>Closed
    Fri 07 Jul 2017 10:27:15 AM UTCbensStatusNone=>Fixed
      Assigned toNone=>dolorous
    Fri 07 Jul 2017 05:32:20 AM UTCdolorousAttached File-=>Added 0001-text-update-placewewant-properly-when-indenting-unin.patch, #41141
      Attached File-=>Added linetest.txt, #41142

    Back to the top


    Powered by Savane 3.1-cleanup1