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

 
 

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

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

Submitter:  David Lawrence Ramsey <dolorous>
Submitted:  Thu 17 Aug 2017 10:18:30 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  dolorous Open/Closed:  Closed

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-08-28 bens Open/ClosedOpen Closed
    2017-08-18 bens Severity3 - 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
    2017-08-17 dolorous Attached 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
    2017-08-17 dolorous Attached File- Added tabtest1.txt, #41560
        Attached File- Added tabtest2.txt, #41561

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code