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

 
 

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

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

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

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

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

Benno Schulenberg <bens>
Group 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>
Group Member

 

(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 bens (Posted a comment)
  • -email is unavailable- added by dolorous (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
    2017-07-22 bens Open/ClosedOpen Closed
    2017-07-07 bens StatusNone Fixed
        Assigned toNone dolorous
    2017-07-07 dolorous Attached 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.13-758e.
    Corresponding source code