[Lazarus] About 0013268: SynEdit parses every line twice on load or paste (Attn: Flávio)
Martin Friebe
lazarus at mfriebe.de
Thu Mar 5 17:47:50 CET 2009
Martin Waldenburg wrote:
> Hans-Peter Diettrich schrieb:
>
>> I found it sufficient when the highlighter only parses the current
>> line(s) while painting the text.
>>
>
> By the original design the highlighter parses only more than one line if
> the Range
> is changed by typing.
> There is no logical reason to change this behavior, folding or not
> doesn't matter.
> But a lot of people have been made changes, which never understood nor
> even have tried
> to understood how the editor is working.
> One can only wonder why people are so reluctant to use their brain for
> what it has been created, thinking.
>
That (AFAIK) is again different from the issue at hand.
If you modify a line by inserting text into the line, then the
highlighter should scan based on the stored info what the range was at
the start of line (*).
The Range found after Highligher did scan, is compared with the Range on
the next Line, and scanning stops.
Some of the highlighting (actually folding) added (by me) needed more
complexity. I understood (or believe I did) the existing scheme, but had
to break it. As a consequence, at the End of the Range an extra line may
have to be checked. The cost on normal operation can be ignored.
(No one can type this fast / any code calling functions like this in a
loop, should do BeginUpdate)
(*) For this it does not matter, if "Ranges[LineIndex]" is:
- the Range as on the Start of this line
- the Range as on the end of this line (because if you need the
start-range you get it from the previous line)
------------------------------
The issue at hand was originally described as:
The Range at the end of the very last line is not stored.
If you add a line below the end of file, you must scan both lines:
- the old last line to get the range for the start of the next (new) line
- the new line (and actually there is no reason to scan that new line,
the result is discarded => yet currently it is scanned)
According to the submitter Lines.BeginUpdate doesn't work (I have not
verified this).
*IF* that is the case the currently the following
BeginUpdate
for a := 1 to 100 do Lines.Add( xxxxx );
EndUpdate
would scan each line twice.
=> It should not. If BeginUpdate works, they are all scanned once in a
single go.
So in truth the problem at hand is/are:
- if BeginUpdate does work or does not work.
- Scanning the last line and the discarding the result (see my next mail)
Best Regards
Martin
More information about the Lazarus
mailing list