[Lazarus] Regex and Syntax Highlighting
Martin
lazarus at mfriebe.de
Wed May 26 21:41:39 CEST 2010
On 26/05/2010 20:29, Mattias Gaertner wrote:
> On Wed, 26 May 2010 20:09:47 +0100
> Martin<lazarus at mfriebe.de> wrote:
>
>> On 26/05/2010 19:54, Mattias Gaertner wrote:
>>
>>> Apparently it uses some kind of line state too and only updates
>>> till the visible area. Maybe synedit can do the same. At the moment
>>> syndit updates everything too often.
>>>
>>>
>> It's been on my todo for a long time (and some prep work, like moving
>> highlighter related functions from synedit to highlighter have started....)
>>
>> It will be limited though => because folding needs to know the full deal
>> (as scrollbars depend on the total of visible (unfolded) lines.
>> Of course, if no nodes are folded => folding doesn't care (even if
>> switches on). It's only when a node actually is folded => then folding
>> needs to verify it still exists.
>>
> I see.
> But at least "replace all" could be improved.
>
Hm How to you mean. Unless there is a bug I don't know about.
The search replace is done inside a "PaintLock" => that (to the very
best of my knowledge) prevents the highlighter from doing anything.
Only one exception:
- if you chose to "prompt and confirm" => then each time a prompt comes,
the paintlock is interupted, and a rescan is done => but this si needed,
because in order to prompt, the display must be updated => the
highlighter must scan.
But without prompt, it should only scan once at the end of the replace.
(if there is evidence it does more => let me know)
>> Another improvement (but much less noticable) would be to separate
>> structural and visual scan.
>>
> But that would mean traversing two times though the code. Bad for
> processor caching.
>
Not more than currently:
1) The highlighter scans the in order to update all ranges (but that
does not store any mid-line info)
2) each time a line is painted => that line is parsed, and token by
token returned to be painted.
so the first scan can skip alot of details => but it requires a lot of
rewrite work on the highlighter.
there is plenty of other optimizations in and outside the highlighter....
Martin
More information about the Lazarus
mailing list