- fix: correctly update brackets level
This commit is contained in:
parent
b6df4fcf41
commit
ad5b3f5e28
|
@ -2776,7 +2776,11 @@ int SynEdit::scanFrom(int Index)
|
||||||
mHighlighter->nextToEol();
|
mHighlighter->nextToEol();
|
||||||
iRange = mHighlighter->getRangeState();
|
iRange = mHighlighter->getRangeState();
|
||||||
{
|
{
|
||||||
if (mLines->ranges(Result).state == iRange.state)
|
if (mLines->ranges(Result).state == iRange.state
|
||||||
|
&& mLines->braceLevels(Result) == mHighlighter->getBraceLevel()
|
||||||
|
&& mLines->bracketLevels(Result) == mHighlighter->getBracketLevel()
|
||||||
|
&& mLines->parenthesisLevels(Result) == mHighlighter->getParenthesisLevel()
|
||||||
|
)
|
||||||
return Result;// avoid the final Decrement
|
return Result;// avoid the final Decrement
|
||||||
}
|
}
|
||||||
mLines->setRange(Result,iRange);
|
mLines->setRange(Result,iRange);
|
||||||
|
@ -2975,26 +2979,33 @@ void SynEdit::findSubFoldRange(PSynEditFoldRanges TopFoldRanges, int FoldIndex,P
|
||||||
|
|
||||||
//we just use braceLevel
|
//we just use braceLevel
|
||||||
if (useBraces) {
|
if (useBraces) {
|
||||||
|
// Find an opening character on this line
|
||||||
|
CurLine = mLines->getString(Line);
|
||||||
|
|
||||||
int curBraceLevel = mLines->braceLevels(Line);
|
int curBraceLevel = mLines->braceLevels(Line);
|
||||||
if (curBraceLevel > lastBraceLevel) {
|
if (curBraceLevel > lastBraceLevel) {
|
||||||
// Add it to the top list of folds
|
for (int i=0; i<curBraceLevel-lastBraceLevel;i++) {
|
||||||
Parent = parentFoldRanges->addByParts(
|
// Add it to the top list of folds
|
||||||
Parent,
|
Parent = parentFoldRanges->addByParts(
|
||||||
TopFoldRanges,
|
Parent,
|
||||||
Line + 1,
|
TopFoldRanges,
|
||||||
mCodeFolding.foldRegions.get(FoldIndex),
|
Line + 1,
|
||||||
Line + 1);
|
mCodeFolding.foldRegions.get(FoldIndex),
|
||||||
parentFoldRanges = Parent->subFoldRanges;
|
Line + 1);
|
||||||
|
parentFoldRanges = Parent->subFoldRanges;
|
||||||
|
}
|
||||||
} else if (curBraceLevel < lastBraceLevel) {
|
} else if (curBraceLevel < lastBraceLevel) {
|
||||||
// Stop the recursion if we find a closing char, and return to our parent
|
for (int i=0; i<lastBraceLevel-curBraceLevel;i++) {
|
||||||
if (Parent) {
|
// Stop the recursion if we find a closing char, and return to our parent
|
||||||
Parent->toLine = Line + 1;
|
if (Parent) {
|
||||||
Parent = Parent->parent;
|
Parent->toLine = Line + 1;
|
||||||
if (!Parent) {
|
Parent = Parent->parent;
|
||||||
parentFoldRanges = TopFoldRanges;
|
if (!Parent) {
|
||||||
} else {
|
parentFoldRanges = TopFoldRanges;
|
||||||
parentFoldRanges = Parent->subFoldRanges;
|
} else {
|
||||||
}
|
parentFoldRanges = Parent->subFoldRanges;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastBraceLevel = curBraceLevel;
|
lastBraceLevel = curBraceLevel;
|
||||||
|
|
Loading…
Reference in New Issue