Tue 15 Mar 2016 04:14:09 PM UTC, original submission:
When for a certain color the start= and end= regexes are equal (or at least can sometimes match the exact same string), then after breaking and then restoring the start string things remain colored in a wrong manner.
To reproduce, add the following three lines at the end of your .nanorc:
syntax "snake"
color brightred "^#.*"
color green start=""""([^"]|$)" end="(^|[^"])""""
Then start nano with 'src/nano -Ysnake', and paste the following ten lines into it:
"""
One
"""
#comment
statement
"""
Two
"""
Now, you can delete any double quote in any of the latter three triplets and then restore it, and colorings will return to what they should be. But if you do that for the first triplet (delete a quote and then restore it), then the comment and the statement will remain green. Typing then an extra quote will restore the proper colorings.
This latter behavior inspired the attached patch.
If instead of typing an extra quote, you delete the earlier deleted quote again, then not only the first two lines but also the last two lines become discolored. Only typing an extra quote again (after putting back the missing quote) will restore the proper coloring.
I will see how the patch fares in other circumstances...
|