bugGNU nano - Bugs: bug #52791, two replacements are made where it...

 
 

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

bug #52791: two replacements are made where it should be just one

Submitter:  Benno Schulenberg <bens>
Submitted:  Wed 03 Jan 2018 10:03:53 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 09 Jan 2018 04:14:49 PM UTC, comment #2: 

Fixed in git, commit e5440b39.

Benno Schulenberg <bens>
Group administrator
Wed 03 Jan 2018 10:52:56 AM UTC, comment #1: 

(Correction: the three replacements were fixed since nano-2.7.5.)

Benno Schulenberg <bens>
Group administrator
Wed 03 Jan 2018 10:03:53 AM UTC, original submission:  

To reproduce, first run:

    echo xxx >exes

then run:

    src/nano +1 exes

and type: M-R xx <Enter> xxx <Enter> Y Y.

Notice that when it first asks whether to replace this ocurrence, the final "xx" are highlighted.  And then for the second question the first "xx" are highlighted.  This is not what should happen.

Expected behavior: for the first and only question the leading "xx" are highlighted.  Whether or not they are replaced, there should be no second question as only one "x" remains after the first match.  (Only when doing the replacements backwards, M-B, is it okay for the question to be asked more than once, because we take just one step back, not the size of the search string, so the match can overlap with a previous one.)

The bug is old, since at least nano-2.2.6.  In that version, nano would even do three replacements, but that has been fixed since nano-2.7.4.  But the problem of the replacements not starting at the cursor but one step beyond is still there.  At that time I just let it be, but now it starts to be annoying: it is unexpected and simply wrong.

Attached patch appears to fix both this issue and bug #52789.

Benno Schulenberg <bens>
Group administrator

 

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

 

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

    Date Changed by Updated Field Previous Value => Replaced by
    2018-01-30 bens Open/ClosedOpen Closed
    2018-01-09 bens StatusIn Progress Fixed
    2018-01-03 bens Summarynano does two replacements where it should do just one two replacements are made where it should be just one
    2018-01-03 bens Attached File- Added 0001-replacing-don-t-skip-the-first-character-of-a-backwa.patch, #42798

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code