[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gb.highlight could do with none.highlight


Le 19/11/2026 à 18:13, Bruce Steers a écrit :
I've been making an editor that uses gb.highlight.

I just hit a bug (in my own coding) that before i started changing a lot of code I thought of a simple workaround that worked.

The bug was this...

I had many lines of code similar to this...
If TextHighlightr[MyEditor.Highlight].CanReWrite Then

You shouldn't. You must store a reference on 'TextHighlighter[MyEditor.Highlight]' somewhere and use it directly instead of recomputing it repeatedly.


All was good untill i laded a document that did not use highlighting so the editors Highlight property was either blank or "none"

So then i looked at the code and all the places i'd have to change to work differently if there was no highlighter.  there were many places :(

But then i had an epiphany..
I added the following as TextHighlighter.class in my project....
> ...

I will add a "None" highlighter that does nothing. But it should not be a huge problem in your code to handle the non-highlight case without it!

Regards,

--
Benoît Minisini.


References:
gb.highlight could do with none.highlightBruce Steers <bsteers4@xxxxxxxxx>