Are you pointing to bugfix I show above,
or are you answering my question,
or you show me another bug?
I saw that line of code when I diffed your latest commits.
I did not test, but suspect that it might interfere with existing features.
I was not talking of your color only
the pas dl has an option to highlight all case labels (in the IDE you can configure this / I use a frame around them).
Having nested "if" blocks means keeping track of where an else belongs.
I have not tested your change. But it may break this existing behaviour.
As for your colors. You do not highlight the case labels 1: or 2: so the "else" of the case should also be ignored.
There is a bigger problem:
1) ANode.FoldLvlEnd may be removed in future
2) never mind the future. In the IDE you can configure what folds, and what does not fold. You can disable folding for "begin" blocks.
If you do, then for a begin block the level will no longer increase. So if you have nested begin blocks (nested loops) then all begin will have the same color.
I said it before: the level is not intended for what you do. It only server finding opening and closing lines.
When you prepare FHighlights, then you know how many outer lines there are. So you can set the colors from the content of FHighlights.
However you have special cases.
1) "If" No increase in color wanted
add an action (to the inner) sfaOutlineMergeParent.
2) extra increase ("begin" in nested proc)
add an action sfaOutlineExtraLevel
those are just actions. there are no new modes.
The HL can add them in InitNode. (or somewhere like that)