I am now working in drawing vertical lines.
I found that most efficient way to draw these lines is by: just reading the cache.
What cache?
so I will move the PrepareMarkupForRow's content into DoTextChanged.
DoTextChanged can be called a lot more often. THat is not a good idea. It can also be called for of screen changes.
It is meant to be used to invalidate cached data, usually be setting a flag (which does not cost time) "InvalidateNeeded := true;"
Well, that means we still use PrepareMarkupForRow?, and DoTextChanged was not the right place to save the open~close--open~close folding list through several lines?
IMHO, Then the problem (with current version of SynEdit) is: identifiying of verticals line couldn't be efficient.
You know, in TSynEditMarkupWordGroup we search at least one pair of begin~end.
But in my TSynEditMarkupFoldColors, below sample require at least 5 pair begin~end for getting the correct position of it's 5 vertical lines:
| | | | | HorzEntry := EMPTY_ENTRY;(see attachment for complete lines)Sure, we can do searching these 5 pairs on PrepareMarkupForRow, but AFAIK its not efficient in a long procedure/code.
In other words, why we should repeat finding all pairs per line, while we can do that once per screen changes (DoTextChanged) ?
I choose DoTextchanged because it is the only chance before iteration of each line.
DoTextChanged is also paired with MarkupFinish(); Maybe I need something new like MarkupStart() that works outside the iteration of painting each lines.
Simply: When
DoTextChangedMarkupStart is not the right place, IMHO PrepareMarkupForRow is even worst.
I think any other TSynMarkup is useless for comparing with TSynEditMarkupFoldColors's job
Thats why I planned that special case.
-----
But, wait...
There is another possible choice, which may best to do:
If PrepareMarkupForRow is really the only chance to identify the position of 5 vertical lines,
so it can be very efficient if there was no calculation/searching the pairs at all
in PrepareMarkupForRow.How it will be done?
The highlighter (TSynCustomFoldHighlighter) should able to provide those 5 vertical lines's position !
This way, the job done in PrepareMarkupForRow by simple
TempNode := NodeList[ i ]; The real calculation is in TSynCustomFoldHighlighter (or descendant) which is the correct class who know how to.
Further, for simplify the TSynCustomFoldHighlighter's filter when deal without vertical-lines's requirement,
I guess it should be something config, like :
FoldFlag := [sbfIncludeDisable,
sbfIncludeParents] ?
What cache?
The NodeList thats done calculated outside the PrepareMarkupForRow, that is cache in my mind.