Multiple word and syntax highlighting
Posted: Mon Jun 28, 2021 1:13 pm
With TRichViewEdit, I'd like to be able to have multiple occurrences of a given word highlighted, as well as some basic syntax highlighting too. On both of these, I only need and want it marked within the displayed (visible) text, not the entire text. Unmarking either multiple words or syntax would have to be done for the entire text. I'm doing this right now with the Scintilla edit component but Scintilla does not handle images.
I've had limited success using the RectMarks and MarkSubString calls. MarkSubString does the marking more like I want (i.e., different backcolor), but it affects all the text and slows down with a big file, and I can't figure out how to un-mark what it marks. Syntax would mostly be bold keywords and color on keywords.
If it's possible, I'd like to mark and un-mark text without using actual text selections. I have some basic marking working now using text selections, but I have to save and restore the initial selection as well as VScrollPos and HScrollPos to keep it all from jumping around. And the only way I've found to un-mark it all is by brute force: I select all and then apply a normal text style. There must be a better way...
My questions are:
- Is there a way to work with just the displayed part of the text?
- Is there a fast way to "un-mark" everything that was previously marked while leaving other text formatting alone?
- Is there a way to add setting font styles (bold, italic etc.) to MarkSubString? Color and BackColor work but I want font style as well.
Thanks. I hope this all makes sense. I'll attach a screenshot of the effects I'm after.
I've had limited success using the RectMarks and MarkSubString calls. MarkSubString does the marking more like I want (i.e., different backcolor), but it affects all the text and slows down with a big file, and I can't figure out how to un-mark what it marks. Syntax would mostly be bold keywords and color on keywords.
If it's possible, I'd like to mark and un-mark text without using actual text selections. I have some basic marking working now using text selections, but I have to save and restore the initial selection as well as VScrollPos and HScrollPos to keep it all from jumping around. And the only way I've found to un-mark it all is by brute force: I select all and then apply a normal text style. There must be a better way...
My questions are:
- Is there a way to work with just the displayed part of the text?
- Is there a fast way to "un-mark" everything that was previously marked while leaving other text formatting alone?
- Is there a way to add setting font styles (bold, italic etc.) to MarkSubString? Color and BackColor work but I want font style as well.
Thanks. I hope this all makes sense. I'll attach a screenshot of the effects I'm after.