[Lazarus] Synedit highlighting

Brad Campbell brad at wasp.net.au
Sun Nov 23 12:23:53 CET 2008


Martin Friebe wrote:
> Brad Campbell wrote:
>> Is there any way of setting the default background colour of a line from a SynHighlighter?
>>
>> I need to change the background colour based on the currently assigned range. I have been doing it 
>> with a hack to synedit that leaves the background colour the same as the bgcolour of the last token 
>> attribute on each line, but it's nasty and I'd rather find a correct way to do it.
>>   
> You could have a whole range of tokens(id), for which the background 
> color was what you wanted, then you would return the token(id) from the 
> appropriate range.

That is actually how I was doing it, but after the last token the colour would then change to some 
random sampling of whatever it thought the background was supposed to be at the time.

I had a one line hack that set colEditorBG := attr.Background inside PaintLines() which worked a 
treat (It would always leave the remainder of the line as the background colour of the last token on 
the line) but that got broken by r17523 which insists on forcing the colour of the remainder of the 
active line to white. At this point I decided I needed to find an approved method for setting this 
colour.

> Another workaround would be to write a special SynMarkup-class (like 
> match-brackets, current selection, special line), to go with the 
> highlighter.

I'll poke my head inside the markup class and see what I can find. Thanks :)

Regards,
Brad
-- 
Dolphins are so intelligent that within a few weeks they can
train Americans to stand at the edge of the pool and throw them
fish.



More information about the Lazarus mailing list