AFAIK each FoldBlock represents a logical area of folding system.This is at least ambigious, if not misleading.
It seem that a single FoldBlock is enough for storing the whole lines via it's unlimited nested Children.not sure what is meant by this?
HL only have one FoldBlock : HL.RootCodeFoldBlock Once its created, wouldn't be replaced. (immutable).The top level is always "unfolded". But it has (can have) many (siblings or nested) children. So there are many blocks.
HL has one Range (property CodeFoldRange) for one timesee last comment.
this property is immutable; meaning the value is replaced one with other when the line being parsed is switched from one line to next line (and so from one to random line index).
a Range is created when HL is start parsing the first line.
another range is created when HL start parsing the next line.
But, When the first line is being re-parsed,
a new range is recreated.
Therefore a new range is also created when second line was being re-parsed.
being amazed ?
Now the show:It happens when the text is first loaded.
SynEdit works in per line basis.
So parsing the whole lines from first to last would never happen.
Q: Wow, I am now noticed that SynEdit has such stupid behaviour: reparsing a line more than once.SynEdit (core) itself does not trigger or need "reparsing"
A: You are another stupid when exposed earlier conclusion without knowing the big design behind it.
Q: Lets Don't be pedantic. When a line is unchanged, why this line being parsed twice or thousands time?It is not. (not thousands)
Q: can the parsed info be stored statically, so parsing will only be required once?
1) I found the TSynPasSyn introduces a new Range class : TSynPasSynRange.
it can't directly use TSynCustomHighlighterRange (for folding), by the reason of extend the infos attached to this class.
Meaning: TSynPasSynRange introduces new properties: PasFoldEndLevel, PasFoldMinLevel, PasFoldFixLevel, LastLineCodeFoldLevelFix, BracketNestLevel, Mode.
I think it's bad design. Because, each ancestor will also introduce new Range class, by only the reason of extending the infos being added?
This way, will bother any HL ancestor, because the new introduced range class will be used almost everywhere inside the ancestor HL class.
The real world solution is will be something like PNodeInfo of TVirtualTree.
Using this solution, HL author will only inherit a few method, no new class maintenance of the range class, and many other benefit of clean maintainability.