PavelTorgashov / FastColoredTextBox

Fast Colored TextBox for Syntax Highlighting. The text editor component for .NET.
Other
1.21k stars 464 forks source link

Issue with FastColoredTextBox C# string highlighting #164

Open Hexman768 opened 5 years ago

Hexman768 commented 5 years ago

Description

I seem to have discovered that when this small portion of my code is disabled via multiple lines of single comments, there is an issue with the syntax highlighting as shown below.

Example

Single_Comment


Issue


Description (cont.)

But when I comment out the very same line with either a multi-line comment or a multi-line comment on top of the single line comments, the issue is no longer present.


MultiLineComment

Or

MultiLineOnSingleLine


Result


NoIssue


I believe this to be an issue with the regex pattern that the c# syntax highlighting function uses to recognize strings, specifically multiple single line comments one on top of the other.

Hexman768 commented 5 years ago

The issue could also lie within the regex patterns for mult-line comments underneath single-line comments. But I am only speculating.

Hexman768 commented 5 years ago

Update: The issue also persists when there are no comments of any kind in that function.


NoComment

Hexman768 commented 5 years ago

Update no. 2: Issue doesn't seem to have actually been fixed by the placement of the multi-line comments. It actually seems as though putting a multi-line comment seems to resolve the issue up to that point.


Update

Hexman768 commented 5 years ago

Update no. 3: The issue seems to have been resolved with the code change here.


I can also confirm that the comments highlighting functionality has not been broken in any way and the file seems to be highlighted correct after my code change. Should I open a PR with the code change?

Hexman768 commented 1 week ago

This issue is actually mostly resolved, however there is a small issue where sometimes strings will be highlighted when inside comments in C# syntax. I will provide a screenshot below:

image