bugGNU nano - Bugs: bug #50135, nano makes too many replacements...

 
 

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

bug #50135: nano makes too many replacements when 'from' and 'to' are nearly equal

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 24 Jan 2017 10:20:05 AM UTC
   
 
Severity:  3 - Normal Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Wed 25 Jan 2017 10:38:08 AM UTC, comment #2: 

Fixed in git, 3534d8ff.

It now does just two replacements (in the forward direction) and puts the cursor back where it was.

Benno Schulenberg <bens>
Group administrator
Tue 24 Jan 2017 01:21:44 PM UTC, comment #1: 

The "hanging" issue mentioned near the end has been reported separately as bug #50137.  So this bug is just about the making of too many replacements in the current line in the forward direction.

Benno Schulenberg <bens>
Group administrator
Tue 24 Jan 2017 10:20:05 AM UTC, original submission:  

To reproduce, run 'echo xxx >exes' and then 'nano --ignore exes'.  Then type: M-R xx <Enter> xxx <Enter>.  Then type Y for every prompt.  Nano asks /three/ times: first for the final two xx, then for the first two, and then again for the final two.  Wrong.  And after the three replacements, the cursor sits at the /end/ of the line, instead of at the beginning.  Wrong too.

One might expect nano to ask only once: for the first two, and that should be it.  But since nano will not start replacing right where the cursor is but one step beyond, it would be defensible that nano asked twice: for the final two, and then, wrapping around, for the first two.  But that should then really be it, because the cursor has reached the starting point.

This bug is old too, since at least nano-2.0.2.

In current git, the behavior is even worse, although somehow more understandable: it does /four/ replacements.

For comparison: doing the replacements backwards:
M-R M-B xx <Enter> xxx <Enter>
will do just two replacements, in all released versions of nano.  In current git it will "hang": it will do infinite replacements, because it never seems to move the cursor from where it found the first match.

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

    Date Changed by Updated Field Previous Value => Replaced by
    2017-02-24 bens Open/ClosedOpen Closed
    2017-01-25 bens StatusIn Progress Fixed
    2017-01-24 bens StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code