Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlight one character at a time, line by line.? #264

Open
Kmicic opened this issue May 12, 2024 · 1 comment
Open

Highlight one character at a time, line by line.? #264

Kmicic opened this issue May 12, 2024 · 1 comment

Comments

@Kmicic
Copy link

Kmicic commented May 12, 2024

How to set highlighting attributes line by line for each character in a line according to the entered pattern?
The picture will explain it better. I enter the pattern into the text field and the highlighting is performed in the appropriate text columns. I can have an array of pattern and lines but I don't know how to set the style for a single character.

toto-highlighter

@Kmicic
Copy link
Author

Kmicic commented May 14, 2024

I did it without regular expressions by comparing characters line by line. Even for a large number of lines the result is satisfactory. Thank you. I'm closing the topic unless someone has a better idea. :)

				int k = 0;
				for (int j = 0; j < lineList.Length; j++)
				{


					if (typeList[k].Contains(lineList[j]))
					{
						FastColoredTextBoxNS.Char value = range.tb[i][j];
						value.style = styleLayer;
						range.tb[i][j] = value;

					}
					if ("1Xx2".Contains(lineList[j])) k++;
					if (k >= typeList.Count) break;
				}
			}

			range.tb.Invalidate();

screen-highlight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant