patchGNU nano - Patches: patch #8182, Improve strange scrolling...


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

patch #8182: Improve strange scrolling behaviour when softwrap is on.

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sat 14 Sep 2013 03:28:22 PM UTC  
Priority:  5 - Normal Status:  Done
Privacy:  Public Assigned to:  Benno Schulenberg <bens>
Open/Closed:  Closed Release:  None

( Jump to the original submission)

Wed 26 Mar 2014 09:51:48 AM UTC, comment #6:

Should be fully fixed after r4643, three weeks ago.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Mon 03 Mar 2014 12:53:41 PM UTC, comment #5:

Attached patch has gone into SVN; I believe this is the fully correct computation. Some of the surrounding code can probably be simplified or removed, because 'onlastline' is not determined correctly, and 'openfile->current_y == editwinrows - 1' is only ever true when 'amount' is bigger than zero (well, in softwrap mode, that is).

Ehm... the M-+ scrolling function now needs to be fixed -- the '(amount ? amount : 1)' isn't doing what I wanted it do.

(file #30757)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 02 Mar 2014 05:18:39 PM UTC, comment #4:

Okay, this new patch should fix it. In retrospect it kind of reproduces the extracuzsoft computation in winio.c, but in a way that I can understand it: without using this maxrow thing. It can probably be simplified, but for now it will do.

(file #30752)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Fri 28 Feb 2014 09:52:05 AM UTC, comment #3:

It's still not entirely fixed. Do an 'stty rows 25 cols 80' and then open the attached example file with 'nano -$'. Do a PageDown, and then do CursorDowns until reaching the "second overlong line" -- it doesn't scroll fully into view. One more CursorDown, and also the third overlong line only becomes partly visible. Another CursorDown, and the screen jumps half a page.

(file #30733)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Mon 16 Sep 2013 07:48:17 PM UTC, comment #2:

Okay, am attaching a better patch. With this patch, I can't find any jumpy or unexpected scrolling behaviour any more. It also fixes the non-showing last line reported in comment #1 of bug #27550 (

(file #29152)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sun 15 Sep 2013 04:15:28 PM UTC, comment #1:

Neh... Not fixed entirely. When walking not all the way back to the top, but just one line short, leaving one line of "ho ho ho" visible, and then walking down again, reaching the first "ho" does not scroll both missing lines into view but only one.

Somehow this whole mechanism of 'maxrows' doesn't taste right... All that is needed is: when the cursor lands on an overlong line, are the number of lines it takes to display it plus the current screen line number bigger than the number of edit rows, then scroll the difference.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Sat 14 Sep 2013 03:28:22 PM UTC, original submission:

When softwrap is enabled and there is an overlong line in the file, walking up and down through it results in unexpected scrolling behaviour. To reproduce this, first create a test file that is adapted to your terminal size:

read <<<$(stty size) ROWS COLS; MORE=145
while (($ROWS > 5)); do echo ah; ROWS=$(($ROWS-1)); done >tessie
while (($COLS > 5)); do echo -n ho\ ; COLS=$(($COLS-1)); done >>tessie
while (($MORE > 5)); do echo =; MORE=$(($MORE-1)); done >>tessie

Now run 'nano -S -$ tessie'. In the following, use only the Cursor-Up and Cursor-Down keys. First walk down. When stepping beyond the bottom, the three lines of "ho ho ho" jump into view as a whole, as expected. Now go back, all the way to the top of the file, then go back down. Two lines before reaching the bottom, the screen scrolls one line, showing the first line of the "ho ho ho"s.

(This is because when the three lines of "ho" jumped into view, the value of 'maxrows' was decreased by two, and this value does not get recalculated when the lines get scrolled out of view again. The patch fixes this, it recalculates 'maxrows' not only when doing PageUp or PageDown, but also when doing smooth scrolls.)

Now go three more lines down, stepping beyond the "ho"s -- the screen jumps half a page! With a mistaken value of 'maxrows' and part of the overlong line already visible, Nano thinks the cursor has gone off the screen and thus recenters it. Patch fixes this too.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.


Attached Files
file #30752:  nanana--scrolling.patch added by bens (3KiB - text/x-diff)
file #30733:  overlong.text added by bens (586B - text/plain)
file #29136:  recalculate-usable-rows-often.patch added by bens (382B - text/x-patch - adds a needed recomputation of the number of available rows)


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)

    Do you think this task is very important?
    If so, you can 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 13 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2014-03-26 bens StatusIn Progress => Done
        Open/ClosedOpen => Closed
    2014-03-03 bens Attached File- => Added nano--fix-the-softwrap-scrolling.patch, #30757
    2014-03-02 bens Attached File- => Added nanana--scrolling.patch, #30752
    2014-02-28 bens Attached File- => Added overlong.text, #30733
        StatusDone => In Progress
        Open/ClosedClosed => Open
        SummarySolve strange scrolling behaviour when softwrap is on. => Improve strange scrolling behaviour when softwrap is on.
    2014-02-26 bens StatusNone => Done
        Assigned toNone => bens
        Open/ClosedOpen => Closed
    2013-09-16 bens Attached File- => Added scroll-when-on-overlong-line.patch, #29152
    2013-09-14 bens Attached File- => Added recalculate-usable-rows-often.patch, #29136

    Back to the top

    Powered by Savane 3.3