- fix: code fold parsing not correct

This commit is contained in:
royqh1979@gmail.com 2021-10-04 20:56:57 +08:00
parent 2a3dcf52fa
commit 5180387ec7
2 changed files with 4 additions and 3 deletions

View File

@ -16,6 +16,7 @@ Version 0.6.0
- implement: register file associations - implement: register file associations
- implement: when startup , open file provided by command line options - implement: when startup , open file provided by command line options
- implement: open files pasted by clipboard - implement: open files pasted by clipboard
- fix: code fold parsing not correct
Version 0.5.0 Version 0.5.0
- enhancement: support C++ using type alias; - enhancement: support C++ using type alias;

View File

@ -2792,7 +2792,7 @@ void SynEdit::updateModifiedStatus()
int SynEdit::scanFrom(int Index, int canStopIndex) int SynEdit::scanFrom(int Index, int canStopIndex)
{ {
SynRangeState iRange; SynRangeState iRange;
int Result = Index; int Result = std::max(0,Index);
if (Result >= mLines->count()) if (Result >= mLines->count())
return Result; return Result;
@ -5735,7 +5735,7 @@ void SynEdit::onLinesDeleted(int index, int count)
if (mUseCodeFolding) if (mUseCodeFolding)
foldOnListDeleted(index + 1, count); foldOnListDeleted(index + 1, count);
if (mHighlighter && mLines->count() > 0) if (mHighlighter && mLines->count() > 0)
scanFrom(index, index); scanFrom(index-1, index+1);
invalidateLines(index + 1, INT_MAX); invalidateLines(index + 1, INT_MAX);
invalidateGutterLines(index + 1, INT_MAX); invalidateGutterLines(index + 1, INT_MAX);
} }
@ -5747,7 +5747,7 @@ void SynEdit::onLinesInserted(int index, int count)
if (mHighlighter && mLines->count() > 0) { if (mHighlighter && mLines->count() > 0) {
// int vLastScan = index; // int vLastScan = index;
// do { // do {
scanFrom(index, index+count); scanFrom(index-1, index+2+count);
// vLastScan++; // vLastScan++;
// } while (vLastScan < index + count) ; // } while (vLastScan < index + count) ;
} }