bugGNU nano - Bugs: bug #50273, in current git, replacing fails on...

 
 

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

bug #50273: in current git, replacing fails on the last line of a marked region

Submitter:  Benno Schulenberg <bens>
Submitted:  Fri 10 Feb 2017 10:02:04 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Fri 10 Feb 2017 01:11:14 PM UTC, comment #3: 

Fixed in git, 8f10e364.

And closing because unreleased.

Benno Schulenberg <bens>
Group administrator
Fri 10 Feb 2017 10:48:38 AM UTC, comment #2: 

It also works fine when replacing backwards.  But fails to replace the top occurrence when replacing backwards in a backwardly marked region.  It bails out too quickly.

The problem is that when replacing in a region, in the comparison "line == begin", the "begin" is in fact not the beginning of the region (when replacing forward in a forwardly marked region) but the end, the last line of the region.  And thus, when it finds the occurrence on this last line, came_full_circle is already true, even though it hasn't come full circle in the file at all.

Hmm.  When replacing in a region, the searching should be stopped not only when it finds an /occurrence/ outside of the region, but also when it finds nothing on a line that is entirely outside of the region.  That would solve bug #50158 while avoiding this one.

But that is too invasive.  Better use the same method as for stopping a spellcheck: as soon as top or bottom of file is reached, we know that we've passed through the whole of the selected region.  So findnextstr() will need an extra parameter, 'dont-wrap-around' or 'stop-at-edge', which is true when spellchecking and when replacing in a region.

Benno Schulenberg <bens>
Group administrator
Fri 10 Feb 2017 10:04:13 AM UTC, comment #1: 

It works fine when the very same region is marked backwards.

Benno Schulenberg <bens>
Group administrator
Fri 10 Feb 2017 10:02:04 AM UTC, original submission:  

To reproduce, run 'src/nano --ignore +6,51 README' and type:
M-A  <Down> <Down> <Down>  M-R  the  <Enter>  xxx  <Enter>  A

See how the "the" before "Pine" is not replaced.  If you do four <Down>s instead of three, the "the" before "GPL" will not be replaced.  In version 2.7.4 this worked fine.

The offending commit is 437cb410.  But I don't get it.

Benno Schulenberg <bens>
Group administrator

 

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

No files currently attached

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-10 bens StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code