bugGNU nano - Bugs: bug #65860, with --softwrap and a large...


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

bug #65860: with --softwrap and a large tabsize, the cursor can get misplaced

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 09 Jun 2024 03:07:24 PM UTC
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Mon 10 Jun 2024 06:31:26 AM UTC, comment #2: 

Fixed in git, commit 6c81f609, by not using edit_scroll() when softwrapping and the tabsize is as wide or wider than the viewport.

Benno Schulenberg <bens>
Group administrator
Mon 10 Jun 2024 06:27:51 AM UTC, comment #1: 

Misplacement also occurs when scrolling up.

To reproduce, use the first recipe, then continue to type ^N until line 10 is at the top of the viewport, then type ^P until the cursor is back at the start of line 10.  Then type ^P twice more.

See that the cursor is now at the end of the preceding line, after "selecting text by".  But the cursor should be two rows further up, on the TAB at the start of line 9.  To get it there, type: <Right> <Left>.

Note that moving the cursor left does scroll two rows when it's needed.  So... do_up() and do_down() do something wrong where do_left() and do_right() do it right.

Bug exists since version 2.9.6, commit 0d9080a2: "don't redraw entire edit window when cursor goes offscreen".  That change did not take into account that a tab might cover more than one row.

Benno Schulenberg <bens>
Group administrator
Sun 09 Jun 2024 03:07:24 PM UTC, original submission:  

When the tabsize is double the width of the viewport (or larger), then moving down through a softwrapped file with initial tabs can misplace the cursor.

To reproduce, run in a default xterm (-geometry 80x24):

echo 'bind ^J "{mark}{firstline}{indent}{mark}" main' >jrc

src/nano --rc=jrc --quick --soft --line -x -T152 + README

First type:  ^J
Then type ^N until the cursor is at the bottom of the viewport, at the start of line 10.
Then type ^N once more.

Result: the screen scrolls just one row, while the cursor sits at the end of the second chunk of line 10, and the status bar says: "[ Misplaced cursor -- please report a bug ]".

The cursor should have been one cell further, one row down, at the start of the third chunk of line 10, on the first of the four spaces before "holding Shift".

Somehow nano does not scroll enough when a TAB sends the cursor more than one row further.

Benno Schulenberg <bens>
Group administrator


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

No files currently attached


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.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2024-07-13 bens Open/ClosedOpen Closed
    2024-06-10 bens StatusNone Fixed
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-b921.
    Corresponding source code