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 Sep 14 15:28:22 2013  
Priority: 5 - NormalStatus: Done
Privacy: PublicAssigned to: Benno Schulenberg <bens>
Open/Closed: ClosedRelease: None

(Jump to the original submission Jump to the original submission)

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

Should be fully fixed after r4643, three weeks ago.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Mon Mar 3 12:53:41 2014, 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 Mar 2 17:18:39 2014, 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 Feb 28 09:52:05 2014, 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 Sep 16 19:48:17 2013, 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 Sep 15 16:15:28 2013, 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 Sep 14 15:28:22 2013, 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 (3kB - 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
  • -unavailable- added by bens (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 13 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Wed Mar 26 09:51:48 2014bensStatusIn Progress=>Done
    Mon Mar 3 12:53:41 2014bensAttached File-=>Added nano--fix-the-softwrap-scrolling.patch, #30757
    Sun Mar 2 17:18:39 2014bensAttached File-=>Added nanana--scrolling.patch, #30752
    Fri Feb 28 09:52:05 2014bensAttached File-=>Added overlong.text, #30733
      StatusDone=>In Progress
      SummarySolve strange scrolling behaviour when softwrap is on.=>Improve strange scrolling behaviour when softwrap is on.
    Wed Feb 26 11:40:28 2014bensStatusNone=>Done
      Assigned toNone=>bens
    Mon Sep 16 19:48:17 2013bensAttached File-=>Added scroll-when-on-overlong-line.patch, #29152
    Sat Sep 14 15:28:22 2013bensAttached File-=>Added recalculate-usable-rows-often.patch, #29136

    Back to the top

    Powered by Savane 3.1-cleanup1