bugGNU nano - Bugs: bug #60074, a second start match on a line can...

 
 

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

bug #60074: a second start match on a line can fail to recolor things

Submitter:  Benno Schulenberg <bens>
Submitted:  Thu 18 Feb 2021 11:50:15 AM UTC
   
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Thu 18 Feb 2021 04:17:25 PM UTC, comment #1: 

Fixed in git, commit 0596b875, by checking that there is no other start match after the end match.

Benno Schulenberg <bens>
Group administrator
Thu 18 Feb 2021 11:50:15 AM UTC, original submission:  

To reproduce, run 'src/nano blah.c' and paste these two lines:

123 /*abcdef*/ 456 ghi
xyz*/

Note that "abcdef" is correctly colored as a comment, and that there is an unmatched comment-closing thing at the end of the second line.

Now type a slash plus a star before "ghi".  See that "ghi" itself gets colored as a comment but not "xyz".  This is wrong.  Type ^L.  Now also the second line gets colored as a comment.

The problem is in check_the_multis(), when the check for JUSTONTHIS checks that 'startmatch.rm_so < endmatch.rm_so'.  That check has been wrong since commit d5f9be7d from three years ago.  Since that commit startmatch and endmatch no longer count from the same origin, but endmatch counts from the end of startmatch.  The two cannot be compared.

This bug went unnoticed until now because probably very few people will write two comments on the same line.

Anyway, what needs to happen is that for lines that are marked as JUSTONTHIS, nano needs to check that there is not another start match after the endmatch.  If there is another start match, then probably a redraw is needed.  (It could still be that there is also another end match after that start, but checking that goes too far, it's not worth checking for it to avoid an unneeded redraw.)

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

    Date Changed by Updated Field Previous Value => Replaced by
    2021-02-25 bens Open/ClosedOpen Closed
    2021-02-18 bens StatusNone Fixed

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code