bugGNU nano - Bugs: bug #51480, paging down with --softwrap in a...

 
 

bug #51480: paging down with --softwrap in a binary file can jump back and forth

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Sun 16 Jul 2017 06:17:50 PM UTC  
 
Severity: 4 - ImportantStatus: Fixed
Assigned to: David Lawrence Ramsey <dolorous>Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Mon 17 Jul 2017 09:56:58 AM UTC, comment #3:

Thanks for the patch. Pushed to git, 8b1f283a.

(The absurd behavior when paging down when already at end-of-file, I have rereported as bug #51489.)

And closing because unreleased. (Although there was a slight misplacement of the cursor also in 2.8.5 and before when doing ^V ^V ^Y after opening a binary file with +999999.)

Benno Schulenberg <bens>
Project Administrator
Sun 16 Jul 2017 08:45:08 PM UTC, comment #2:

Can reproduce with /bin/grep, and I have a fix.

The problem is that variable-width softwrap made get_edge_and_target() depend on current_x's being up to date, where the function didn't depend on that before.

The Pico-compatible PageUp and PageDown (i.e. the non-smooth-scrolling PageUp and PageDown) have to start scrolling from the top of the edit window, and scroll down the proper number of lines, so sometimes PageDown at the bottom line actually does change the position. However, since do_page_up() and do_page_down() don't update current_x to the index of the first column of the edit window, the leftedge that gets calculated is wrong.

The attached patch against git 43a5c87 fixes this: current_x is updated along with everything else when paging up or down in non-smooth-scrolling mode, and so it acts as Pico would again (well, how Pico would act if you were to create the hard-wrapped equivalent of the softwrapped binary file, and position everything manually).

(file #41214)

David Lawrence Ramsey <dolorous>
Project AdministratorIn charge of this item.
Sun 16 Jul 2017 06:37:49 PM UTC, comment #1:

When for you it doesn't happen with /bin/grep, try it with another file. For me, with /bin/tar, the back and forth is between two positions.

Problem does not happen with 2.8.5 and before. At least: the jumping is not circular, although there are one or two jumps.

Benno Schulenberg <bens>
Project Administrator
Sun 16 Jul 2017 06:17:50 PM UTC, original submission:

For me, I can reproduce this with current git and then running:

src/nano --ignore --softwrap +-1 /bin/grep

(Note the negative line number after the plus.)

Then slowly keep pressing <PageDown>. The cursor cycles between three positions.

Expected behavior: the cursor stays put at the end of the file.

Benno Schulenberg <bens>
Project Administrator

 

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

Attach File(s):
   
   
Comment:
   

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by dolorous (Updated the item)
  • -unavailable- added by bens (Submitted the item)
  • -unavailable- added by bens
  •  

    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 7 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Mon 17 Jul 2017 09:56:58 AM UTCbensStatusNone=>Fixed
      Assigned toNone=>dolorous
      Open/ClosedOpen=>Closed
    Sun 16 Jul 2017 08:45:08 PM UTCdolorousAttached File-=>Added 0001-moving-fix-non-smooth-paging-s-erroneously-jumping-b.patch, #41214
    Sun 16 Jul 2017 06:37:49 PM UTCbensSeverity3 - Normal=>4 - Important
      Summaryscrolling in a binary file can go into a loop=>paging down with --softwrap in a binary file can jump back and forth
    Sun 16 Jul 2017 06:17:50 PM UTCbensCarbon-Copy-=>Added dolorous

    Back to the top


    Powered by Savane 3.1-cleanup1