- fix: code fold calculation not correct, when editing code

This commit is contained in:
royqh1979@gmail.com 2021-10-09 23:09:08 +08:00
parent f9678288cf
commit 14ff15ebc1
2 changed files with 10 additions and 3 deletions

View File

@ -3,6 +3,7 @@ Version 0.6.3
- fix: can't copy contents in a readonly editor
- fix: project's file not correctly syntaxed when open in editor
- libturtle update: add fill() / setBackgroundColor() /setBackgroundImage() functions
- fix: code fold calculation not correct, when editing code
Version 0.6.2
- fix: The Enter key in the numpad doesn't work

View File

@ -2831,9 +2831,15 @@ int SynEdit::scanFrom(int Index, int canStopIndex)
iRange = mHighlighter->getRangeState();
if (Result > canStopIndex){
if (mLines->ranges(Result).state == iRange.state
)
&& mLines->ranges(Result).braceLevel == iRange.braceLevel
&& mLines->ranges(Result).parenthesisLevel == iRange.parenthesisLevel
&& mLines->ranges(Result).bracketLevel == iRange.bracketLevel
) {
if (mUseCodeFolding)
rescan();
return Result;// avoid the final Decrement
}
}
mLines->setRange(Result,iRange, mHighlighter->getLeftBraces(),
mHighlighter->getRightBraces());
Result ++ ;
@ -5761,7 +5767,7 @@ void SynEdit::onLinesDeleted(int index, int count)
if (mUseCodeFolding)
foldOnListDeleted(index + 1, count);
if (mHighlighter && mLines->count() > 0)
scanFrom(index-1, index+1);
scanFrom(index, index+1);
invalidateLines(index + 1, INT_MAX);
invalidateGutterLines(index + 1, INT_MAX);
}
@ -5773,7 +5779,7 @@ void SynEdit::onLinesInserted(int index, int count)
if (mHighlighter && mLines->count() > 0) {
// int vLastScan = index;
// do {
scanFrom(index-1, index+2+count);
scanFrom(index, index+count);
// vLastScan++;
// } while (vLastScan < index + count) ;
}