[Lazarus] The color of special characters in the Source Editor

Martin lazarus at mfriebe.de
Thu Sep 15 14:22:02 CEST 2011


On 15/09/2011 13:10, Graeme Geldenhuys wrote:
> On 15/09/2011 14:03, Martin wrote:
>> I only want the scanner to do that if the result is needed. otherwise
>> the structural scan suffers from slow down
> I guess one could look at the Editor Settings (is "show special
> characters" enabled) and if so, is "Text foreground color" non-default,
> then only apply the tokens to comments.  Just a guess. :)
>
>
No I meant something else. Though hopefully, I might be able to add that 
soon.


The highlighter scan for 2 reasons. using the same scan engine, as it is 
a lot of work to write/maintain it, and 99% makes no big diff)

1) structure (e.g for folds, but also where a comment ends, so that 
lines further down are updated)
This must be  done, everytime the text changes (unless, the editor is 
locked, and no paint events will be happening)
If the text changes, then fold gutter will update and also text 10 lines 
after the change may change in color (eg. comment nesting level reduced)

However, in this scan only internal structures are updated.  So it 
doesn't matter if a comment contains a space. It also doesn't matter if 
a word is keyword, unless the keyword changes structure. ("begin"/"var" 
change structure / "if"/"then" do not change structure)

2) scanning current line for painting.
this requires to break down the line, for each color/attribute change

---
So in structure scan, if in a comment, the scanner only needs to look 
for the end of comment. much easier.






More information about the Lazarus mailing list