bugGNU nano - Bugs: bug #52789, replacing does not include the...

 
 

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

bug #52789: replacing does not include the first character of a backward-marked region

Submitter:  Benno Schulenberg <bens>
Submitted:  Tue 02 Jan 2018 05:02:15 PM UTC
   
 
Severity:  4 - Important Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Tue 09 Jan 2018 04:14:16 PM UTC, comment #4: 

Fixed in git, commit e5440b39.

Benno Schulenberg <bens>
Group administrator
Wed 03 Jan 2018 07:55:19 AM UTC, comment #3: 

Forgot to say: the offending commit was c88d7ce5.

Benno Schulenberg <bens>
Group administrator
Tue 02 Jan 2018 08:15:22 PM UTC, comment #2: 

Okay, I understand: it's because the begin_x is the real_current_x, and the latter is the starting point of the region when the region marked backwards, and it is the end point when marked forward.  So only when the region is marked backwards can the condition (found == begin->data + begin_x) fire.

Hmmm.  Maybe that whole OR is not needed any more?

Benno Schulenberg <bens>
Group administrator
Tue 02 Jan 2018 07:44:54 PM UTC, comment #1: 

I don't understand why it skips the first match when the region is marked backwards but not when it is marked forward.  :|  But attached patch seems to fix it.

(file #42790)

Benno Schulenberg <bens>
Group administrator
Tue 02 Jan 2018 05:02:15 PM UTC, original submission:  

To reproduce, run:

    nano +4,4 README

This will put the cursor on the "r" of the word "Overview".
Now type: M-A <Left> <Left> M-R v <Enter> xxx <Enter>.
Result: it says that 'v' is not found.  :|

Now try the same with a forward-marked region, by typing:
M-A M-A <Right> <Right> M-R v <Enter> xxx <Enter> A.
Result: it replaces the v, as it should.

Bug exists since nano-2.7.5.  The cause will be somewhere in the rewriting of the searching code to get the \b and \B regexes right.  I felt that there was something wrong with how the backward movement was done, but I couldn't find any fault with it back then.  And now... I stumbled upon it while making the 2.9.2 release, replacing tabs with nothing in a backward-marked region.

Benno Schulenberg <bens>
Group administrator

 

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

Attached Files

 

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 5 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-02 bens Attached File- Added dont-skip-when-in-region.patch, #42790
        StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code