bugGNU nano - Bugs: bug #61387, miscoloration can occur when a...

 
 

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

bug #61387: miscoloration can occur when a quoted string contains the other quote

Submitted by:  Benno Schulenberg <bens>
Submitted on:  Tue 26 Oct 2021 10:17:21 AM UTC  
 
Severity:  2 - Minor Status:  Fixed
Assigned to:  Benno Schulenberg <bens> Open/Closed:  Open

Tue 26 Oct 2021 11:31:07 AM UTC, comment #1: 

Fixed in git, commit 485eb18d, by folding the regexes for double-quoted and single-quoted strings into one.

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.
Tue 26 Oct 2021 10:17:21 AM UTC, original submission:  

To reproduce, run:

printf "\x22that's\x22 and 'this'" >quoted
src/nano quoted -Ypython

See that «"that's" and '» is colored green while «this'» is uncolored.  This is wrong.  Obviously "that's" and 'this' should be colored green and « and » should be uncolored.

(The same issue can be seen with the go, php, sh, tcl, nftables, javascipt, and autoconf syntaxes.)

The problem is that the two string types are colorized by different rules, which are applied one after the other, meaning that the second rule can match things that are inside a string colored by the first rule.

I don't think that in any language quoted strings can overlap.  Therefore rules that color strings should be in a single regex (when possible), so that overlapping colorations are avoided.

(Problem was found after folding a few regexes into another, and then thinking about whether this might cause miscolorations.  But it turns out that the folding is the right thing to do and things were faulty before.)

Benno Schulenberg <bens>
Project AdministratorIn charge of this item.

 

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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-10-26 bens StatusNone => Fixed

    Back to the top


    Powered by Savane 3.7