bugGNU nano - Bugs: bug #48627, doing a <Right> at the end...

 
 

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

bug #48627: doing a <Right> at the end of a long line, redraws the next line twice

Submitter:  Benno Schulenberg <bens>
Submitted:  Mon 25 Jul 2016 03:08:28 PM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Mon 01 Aug 2016 06:06:17 PM UTC, comment #3: 

Fixed in git, c9e9964.

What isn't fixed yet, though, is a <Ctrl+Right> at the end of a horizontally scrolled line -- that still redraws the target line unnecessarily.  Fixing that will require passing the old xplustabs position to edit_redraw().  Bleh...

(Instead of computing this xplustabs at every corner, it would be better to just store it next to current_x in the openfile struct: openfile->current_column.)

Benno Schulenberg <bens>
Group administrator
Tue 26 Jul 2016 10:46:14 AM UTC, comment #2: 

No, it is not the x position that matters, but the xplustabs position.  (Which is a misnomer, by the way, because it also reckons with multicolumn characters.)  So what should be compared is: the actual column positions before and after the move.

Benno Schulenberg <bens>
Group administrator
Tue 26 Jul 2016 08:34:33 AM UTC, comment #1: 

Attached is a first smurf that avoids the needless redrawings of lines in the case of simple cursor movements (without any vertical scrolling).  There are still needless redrawings in edit_redraw(), but that is something for an other bug.

The patch is rough -- it will require some renaming and regrouping of things later.  This is just to get the correct behavior while changing as few lines as possible.

The basic idea is that, for deciding whether a line needs to be redrawn (that is: horizontally scrolled), the placewewant is irrelevant.  What matters is: what the actual old x position was and what the actual new x position is.  If those two are on different "pages", then redraw the line.

(file #38027)

Benno Schulenberg <bens>
Group administrator
Mon 25 Jul 2016 03:08:28 PM UTC, original submission:  

To reproduce, first create a file named 'double', with two long lines that are two characters shorter than the width of the terminal -- meaning that when you type one extra character at the end of the line, the line will scroll horizontally.  Save the file and exit, and then apply the attached patch.

Then start 'src/nano double'.  It beeps as each of the three lines is drawn (the empty third line is drawn too).  Now verify that moving the cursor around will not redraw any of the lines -- not either when the cursor is moved with <Right> from the end of the first line to the beginning of the second.

Now add one character to the start of each line and type <End> on the first line.  The line is redrawn, because it now is horizontally scrolled.  Then type <Right>.  The first line is redrawn, which is correct, because it needs to be unscrolled.  But then... line 2 is redrawn scrolled and then again redrawn unscrolled.  Buuh!  It shouldn't have been redrawn at all -- there was no need!

Now type <Left> -- only line 1 is redrawn.  Correct, that is how it should work.  Now do <Ctrl+Right> -- line 2 is redrawn once.  That's better, but still overkill.

Expected behavior: a line that is not horizontally scrolled, should never be redrawn.  It's a waste of time and battery life.

Benno Schulenberg <bens>
Group administrator

 

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

Attached Files
file #38027:  use-the-x-position.patch added by bens (6KiB - text/x-diff)
file #38022:  show-redraws.patch added by bens (414B - text/x-diff)

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2016-08-11 bens Open/ClosedOpen Closed
    2016-08-01 bens StatusIn Progress Fixed
        Summarydoing &lt;Right&gt; at the end of a long line, redraws next line twice doing a <Right> at the end of a long line, redraws the next line twice
    2016-07-26 bens Attached File- Added use-the-x-position.patch, #38027
        StatusNone In Progress
    2016-07-25 bens Attached File- Added show-redraws.patch, #38022

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code