diff --git a/NEWS.md b/NEWS.md index 09579cf3..d9996552 100644 --- a/NEWS.md +++ b/NEWS.md @@ -16,6 +16,7 @@ Version 0.6.0 - implement: register file associations - implement: when startup , open file provided by command line options - implement: open files pasted by clipboard + - fix: code fold parsing not correct Version 0.5.0 - enhancement: support C++ using type alias; diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index a6e539d5..c24ddfda 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -2792,7 +2792,7 @@ void SynEdit::updateModifiedStatus() int SynEdit::scanFrom(int Index, int canStopIndex) { SynRangeState iRange; - int Result = Index; + int Result = std::max(0,Index); if (Result >= mLines->count()) return Result; @@ -5735,7 +5735,7 @@ void SynEdit::onLinesDeleted(int index, int count) if (mUseCodeFolding) foldOnListDeleted(index + 1, count); if (mHighlighter && mLines->count() > 0) - scanFrom(index, index); + scanFrom(index-1, index+1); invalidateLines(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) { // int vLastScan = index; // do { - scanFrom(index, index+count); + scanFrom(index-1, index+2+count); // vLastScan++; // } while (vLastScan < index + count) ; }