bugGNU nano - Bugs: bug #62885, with --linenumbers, +/string puts...


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

bug #62885: with --linenumbers, +/string puts cursor on bottom row

Submitter:  Benno Schulenberg <bens>
Submitted:  Wed 10 Aug 2022 03:03:59 PM UTC
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Open

Thu 11 Aug 2022 07:40:17 AM UTC, comment #3: 

Fixed in git, commit 83629b99, by setting the margin to an impossible value just before entering the main loop, so that also during the very first evaluation of the needed margin 'focusing' will be kept TRUE.  It's not possible to simply initialize 'margin' to this value because the tiny version needs 'margin' to be zero.

Benno Schulenberg <bens>
Project Administrator
Wed 10 Aug 2022 03:48:28 PM UTC, comment #2: 

But the actual cause of 'focusing' becoming FALSE (before commit e0a4ee01) is that ensure_firstcolumn_is_aligned() sets it to FALSE, and it does this to prevent the cursor jumping to the center row when line numbers are toggled on.

Benno Schulenberg <bens>
Project Administrator
Wed 10 Aug 2022 03:37:22 PM UTC, comment #1: 

Currently it are these two lines that set 'focusing' to FALSE at startup when --linenumbers is used:

bool keep_focus = (margin > 0) && focusing;
focusing = keep_focus;

So... the margin should be set to an impossible value at startup so that 'keep_focus' will copy the value of 'focusing'.

Benno Schulenberg <bens>
Project Administrator
Wed 10 Aug 2022 03:03:59 PM UTC, original submission:  

To reproduce, run:

src/nano --ignore -x --line  +/pada  NEWS

See that the cursor is on the bottom row.  Unexpected, and incorrect.  Now run the same command but without the --line option:

src/nano --ignore -x  +/pada  NEWS

The cursor is on the center row.  Strange!  What does --linenumbers do that it interferes with 'focusing'?

Bug exists since version 4.4, since the +/string feature was introduced.

Benno Schulenberg <bens>
Project 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
    2022-08-11 bens StatusIn Progress Fixed
        Summarywith --linenumbers, +/string puts cursor on the bottom row with --linenumbers, +/string puts cursor on bottom row
    2022-08-10 bens StatusNone In Progress

    Back to the top

    Powered by Savane 3.9