I decided to fasten the syntax highlighting in the editor. There is an array of words that need to be made fat and blue. The task began to solve in the forehead:
- When entering a character, we analyze the text.
- If you meet the desired word from the list, then assign it the specified style.
There were problems: the analysis takes a long time (keywords are about 200, the text can be voluminous, contain about 1000 lines), noticeably flashing of the selected text (to assign a style in RichTextView you have to select the text, apply the style). Well, when reformatting glitches occur, the style to the selected fragment does not apply or does not apply to the full selection.
Tell me the best option, how to properly implement the color coloring of keywords?