bugGNU nano - Bugs: bug #42189, Searching with softwrap on...

 
 

bug #42189: Searching with softwrap on sometimes wedges the cursor in the lower right corner

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Thu 24 Apr 2014 07:50:17 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned to: None
Open/Closed: OpenRelease: None

Add a New Comment (Rich MarkupRich Markup):
   

You are not logged in

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

 

Sat 21 Jun 2014 11:04:51 AM UTC, comment #5:

I don't like the behaviour much when the crude patch is applied, keeping the cursor all the time in the centre of the screen -- it changes too much from the normal behaviour, where nano won't scroll as long as there are other search results on the screen.

But... maybe I will apply the patch anyway, because it is an easy and effective solution, and apparently not many people are using softwrap, otherwise we should have had this report quite a while ago.

Benno Schulenberg <bens>
Project Member
Fri 20 Jun 2014 12:19:38 PM UTC, comment #4:

In the meantime, to deal with this problem without massive refactoring, there are three edit_redraw() calls in search.c that lead to this problem (which are incidentally fixed by my earlier crude patch that makes edit_redraw() work differently in softwrap mode): one in do_search(), one in do_research(), and one in do_find_bracket(). If all three cases can be adjusted for softwrap mode, that is another way to fix this bug.

David Lawrence Ramsey <dolorous>
Project Administrator
Mon 16 Jun 2014 08:43:27 PM UTC, comment #3:

Looking into this some more to try to improve it, it seems that all the movement code (do_up(), do_down(), etc.) has special handling for softwrap mode, except for the movement induced by the search code, which doesn't do the extra scrolling/updating everything else does.

The best fix would probably be to generalize softwrap handling. Instead of manually adding to current_y and updating in those cases, it would be handled as a virtual y-coordinate which would be adjusted based on line length.

There's already support for virtual x-coordinates using placewewant and xplustabs(). This hypothetical support for virtual y-coordinates would add e.g. linewewant and ypluswraps(), used only in softwrap mode. However, adding this is nontrivial.

David Lawrence Ramsey <dolorous>
Project Administrator
Tue 10 Jun 2014 10:50:05 PM UTC, comment #2:

Addendum: Updated the patch for SVN r4955, adding proper #ifdefs for NANO_TINY in the process. (Cosmetically, I'm unsure how to add the #ifdefs without breaking the line, so I've broken the line for now.)

(file #31535)

David Lawrence Ramsey <dolorous>
Project Administrator
Fri 06 Jun 2014 12:16:48 AM UTC, comment #1:

I've looked into this. In SVN r4943, after doing your search, when the cursor is wedged, if you hit the Home key, the cursor will return to the beginning of the line. At this point, holding the right arrow will scroll the cursor forward through the line as expected, but as soon as it reaches the lower right corner of the screen, the screen doesn't scroll, leading to the cursor's being wedged again.

The problem is somewhere in edit_redraw(). It has no special code to handle softwrap mode, but it apparently needs that in order to update the screen properly. I'm attaching a patch to fix the problem in the crudest way possible (since I'm having trouble understanding the softwrap code): it always assumes the current line is offscreen and updates accordingly when softwrap mode is on. This means that it probably updates the screen too much as is, but it can probably be used as the basis for a better fix.

(file #31509)

David Lawrence Ramsey <dolorous>
Project Administrator
Thu 24 Apr 2014 07:50:17 PM UTC, original submission:

To reproduce: set your terminal to 30 lines 120 columns. Switch colouring off (M-Y) to avoid the further complication of not even being able to see where one is. Open doc/faq.html and search for the string "section" (without the quotes). Then hit M-W to search for the next occurrence. The cursor goes to the lower right corner and no longer seems to respond to <Left> and <Right>.

A <Down> will reveal that nano should have scrolled the screen seven lines before trying to show the next occurrence.

This is both in SVN and in 2.2.2.

Benno Schulenberg <bens>
Project Member

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #31535:  nano4955softwrap.patch added by dolorous (681B - text/x-patch)

 

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)
  •  

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

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 10 Jun 2014 10:50:14 PM UTCdolorousAttached File#31509=>Removed
    Tue 10 Jun 2014 10:50:05 PM UTCdolorousAttached File-=>Added nano4955softwrap.patch, #31535
    Fri 06 Jun 2014 12:16:48 AM UTCdolorousAttached File-=>Added nano4943softwrap.patch, #31509

    Back to the top


    Powered by Savane 3.1-cleanup