bugGNU nano - Bugs: bug #50078, things don't get colored with...

 
 

bug #50078: things don't get colored with certain zero-length regex matches

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Wed 18 Jan 2017 05:13:20 PM 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 20 Jan 2017 04:37:13 PM UTC, comment #1:

Fixed in git, 94907aa5.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Wed 18 Jan 2017 05:13:20 PM UTC, original submission:

To reproduce, add these two lines to your ~/.nanorc:

syntax "aha"
color brightred start="^" end="aha"

Now run 'src/nano -Yaha xxx', and type the following:

so so aha
this is good aha
but
not
now
aha

The first two lines get colored, as expected. But as you finish the last line, only the word "but" becomes red. Wrong. Now save the file, exit, and run the same command again. Now everything is colored, as it should. Now move the cursor to the "now" or "not" line and delete a character. The last three lines lose color again, and don't regain it upon an undo. If you do the same on the "but" line, no discoloration happens.

Problem was found because of a suspicion: the second "Skip over a zero-length regex match." in src/winio.c doesn't look right. It shouldn't abandon the line when a zero-length match is found, it should just advance the pointer one step (because there is no point in painting zero characters). Or maybe not even that; maybe it should advance only over a zero-length end match.

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 24 Feb 2017 10:22:17 AM UTCbensOpen/ClosedOpen=>Closed
    Fri 20 Jan 2017 04:37:13 PM UTCbensStatusNone=>Fixed

    Back to the top


    Powered by Savane 3.1-cleanup1