I need to write a text editor which can merge arbitrary text styles from several sources (in my case: spell checker, style hints like repeated words, links and other markup) using SWT StyledText. I examined the the standard ways to do it:
I could install a modify listener and create the styles for the whole text for each modification. That's pretty slow but accurate.
I could use a
LineStyleListener
. This means I'll have to redraw the text myself (for example in the case of repeated words because some of them will be outside the current edit range) plus the editor doesn't cache the styles, so this API gets called much more often then one would expect.I could use a background reconciler like the IDE does. This means the styling lags behind the edits which is bad from a user perspective.
The icing of the cake is that I need hierarchical styles, so I have to reimplement the StyleRange
API.
Has anyone seen a better solution? Can someone direct me to some examples which do more than highlight keywords?