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

 
 

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

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

Add a New Comment(Rich Markup)
   

You are not logged in

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

 

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

Fixed in git, 8f10e364.

And closing because unreleased.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.

 

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

Attach File(s):
   
   
Comment:
   

No files currently attached

 

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

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 10 Feb 2017 01:11:14 PM UTCbensStatusNone=>Fixed
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1