SynEdit parses every line twice on load or paste
Original Reporter info from Mantis: etrusco
-
Reporter name: Flávio Etrusco
Original Reporter info from Mantis: etrusco
- Reporter name: Flávio Etrusco
Description:
(This is a performance bug; someone might prefer to change it to "tweak" or "feature"...)
There was a bug in the "official" SynEdit that's still (AFAICS) unfixed in Lazarus.
The Range information being stored in the StringList is the range at the start of the associated line (or the end of the previous line), but the range at the end of the associated line should be stored instead.
This makes the whole file be parsed twice on best case (highlighter disabled during file load), and caused (or used to, in official SynEdit) a recursive/exponential parse bug during paste or file load with highlighter enabled.
Additional information:
Currently, in ScanFrom:
Highlighter.ResetRange;
Range[0] := Highlighter.GetRange;
...
Highlighter.SetRange(Range[n -1]);
Highlighter.NextToEol;
Range[n] := Highlighter.GetRange();
I guess it's obvious from this excerpt that Range[0] is currently useless.
And the lack of (stored) range info for the end of the last line will cause the performance bugs mentioned, because we'll need to continually reparse the last line.
Mantis conversion info:
- Mantis ID: 13268
- Version: 0.9.26.1 (SVN)
- Fixed in version: 0.9.29 (SVN)
- Fixed in revision: 25320 (#8616df24)
- Target version: 0.9.30
- LazTarget: 1.0