bugGNU nano - Bugs: bug #51778, horizontal navigation with...

 
 

bug #51778: horizontal navigation with softwrap and straddling tabs is inaccurate

Submitted by:  David Lawrence Ramsey <dolorous>
Submitted on:  Thu 17 Aug 2017 10:18:30 PM UTC  
 
Severity: 4 - ImportantStatus: 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 18 Aug 2017 07:54:23 PM UTC, comment #2:

Thanks for the patches. Pushed to master in 46ccc9ba and 5237a42d.

I don't think these problems were limited to git, but I can't test with 2.8.6 because it simply locks up at startup when using a huge tabsize.

Benno Schulenberg <bens>
Project Administrator
Thu 17 Aug 2017 10:30:10 PM UTC, comment #1:

These are the side effects of do_left()'s using Up/End and do_right()'s using Home/Down to move to the next line; in softwrap mode with tab-straddling chunks and odd tab widths, starting columns of lines may not correspond to indexes, and the fact that all the movement functions start with indexes, convert to columns, change columns, and then convert back to indexes mean that movement can be thrown further and further off the more those functions are used.

In the first case, Up moves the cursor to the first column of row 2, which gets converted to the index of the last column of row 1 because it's inside a tab. Then, since End gets the index and not the column, it moves to the end of the chunk where the index is (the end of chunk 1).

In the second case, Home moves the cursor to the first column of the next-to-last row, which gets converted to the index of the last column of the next-to-next-to-last row because it's inside a tab. Then, since Down gets the index and not the column, it moves to the chunk below where the index is (the end of the next-to-last chunk).

The first attached patch fixes this for both do_left() and do_right(), by replacing their usage of Up/End and Home/Down with simpler and more accurate code (i.e., a manual adjustment of columns, since they're at the beginning and end of actual lines; and then edit_redraw()). The second attached patch removes the be_clever parameter from do_home() and do_end(), since it's no longer used after the first patch.

(file #41562, file #41563)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Thu 17 Aug 2017 10:18:30 PM UTC, original submission:

This applies to git e09dbf1.

For moving left:

1. In an 80x24 terminal, with the first attached text file, run:

./nano --ignore --softwrap -T 7 tabtest1.txt

2. Press PageDown to move to the end of the file, on row 4. Hold down Left until you reach the first column of row 3 (the row with "this is another test" on it). Press Left again. The cursor will move from row 3 to the end of row 1 (technically the first column of row 2, but since that's inside a straddling tab, it gets shifted backward to the last available column of row 1), when it should move to the last column of row 2 instead.

For moving right:

1. In an 80x24 terminal, with the second attached text file, run:

./nano --ignore --softwrap -T 7 tabtest2.txt

2. Hold down Right until the cursor doesn't move anymore. Note that it stops moving on the next-to-last character of the file instead of the last one.

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 9 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 28 Aug 2017 07:10:40 PM UTCbensOpen/ClosedOpen=>Closed
    Fri 18 Aug 2017 07:54:23 PM UTCbensSeverity3 - Normal=>4 - Important
      StatusNone=>Fixed
      Assigned toNone=>dolorous
      Summarynano git's horizontal navigation with softwrap and straddling tabs is inaccurate=>horizontal navigation with softwrap and straddling tabs is inaccurate
    Thu 17 Aug 2017 10:30:10 PM UTCdolorousAttached File-=>Added 0001-softwrap-improve-left-right-navigation-between-lines.patch, #41562
      Attached File-=>Added 0002-weeding-remove-unused-be_clever-parameter-from-do_ho.patch, #41563
    Thu 17 Aug 2017 10:18:30 PM UTCdolorousAttached File-=>Added tabtest1.txt, #41560
      Attached File-=>Added tabtest2.txt, #41561

    Back to the top


    Powered by Savane 3.1-cleanup1