Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-11

Synedit highlighting

3 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Brad Campbell

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.

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.

Reply by email

Martin Friebe
to Brad Campbell
Brad Campbell wrote 6 lines
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.

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

Martin

Reply by email

Brad Campbell
to Martin Friebe
Martin Friebe wrote 10 lines
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.

Reply by email