diff --git a/NEWS.md b/NEWS.md index ead59b3b..68cf4a1b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -29,6 +29,8 @@ Red Panda C++ Version 1.5 - fix: ctrl+click on #include_next header name doesn't open the right file - enhancement: parser used for non-project C files won't search header files in C++ include folders. - fix: toggle block comment/delete to word begin/delete to word end are not correctly disabled when editor not open + - fix: index out of range in cpp highlighter + - fix: memory leak in code folding processing Red Panda C++ Version 1.4 diff --git a/libs/qsynedit/qsynedit/CodeFolding.cpp b/libs/qsynedit/qsynedit/CodeFolding.cpp index e4006b98..7946a0d9 100644 --- a/libs/qsynedit/qsynedit/CodeFolding.cpp +++ b/libs/qsynedit/qsynedit/CodeFolding.cpp @@ -72,16 +72,15 @@ void CodeFoldingRange::move(int count) toLine += count; } -CodeFoldingRange::CodeFoldingRange(PCodeFoldingRange aParent, - int aFromLine, - PCodeFoldingDefine aFoldRegion, int aToLine): - fromLine(aFromLine), - toLine(aToLine), +CodeFoldingRange::CodeFoldingRange(PCodeFoldingRange parent, + int fromLine, + int toLine): + fromLine(fromLine), + toLine(toLine), linesCollapsed(0), collapsed(false), - foldRegion(aFoldRegion), hintMarkLeft(0), - parent(aParent) + parent(parent) { subFoldRanges = std::make_shared(); } @@ -107,16 +106,15 @@ CodeFoldingRanges::CodeFoldingRanges() } -PCodeFoldingRange CodeFoldingRanges::addByParts(PCodeFoldingRange aParent, - PCodeFoldingRanges aAllFold, - int aFromLine, - PCodeFoldingDefine aFoldRegion, - int aToLine) +PCodeFoldingRange CodeFoldingRanges::addByParts(PCodeFoldingRange parent, + PCodeFoldingRanges allFold, + int fromLine, + int toLine) { - PCodeFoldingRange range=std::make_shared(aParent, aFromLine,aFoldRegion,aToLine); + PCodeFoldingRange range=std::make_shared(parent, fromLine,toLine); mRanges.append(range); - if (aAllFold && aAllFold.get()!=this) { - aAllFold->add(range); + if (allFold && allFold.get()!=this) { + allFold->add(range); } return range; } diff --git a/libs/qsynedit/qsynedit/CodeFolding.h b/libs/qsynedit/qsynedit/CodeFolding.h index 3eb4d522..165bba8c 100644 --- a/libs/qsynedit/qsynedit/CodeFolding.h +++ b/libs/qsynedit/qsynedit/CodeFolding.h @@ -67,8 +67,8 @@ public: void clear(); int count() const; CodeFoldingRanges(); - PCodeFoldingRange addByParts(PCodeFoldingRange aParent, PCodeFoldingRanges aAllFold, - int aFromLine, PCodeFoldingDefine aFoldRegion, int aToLine); + PCodeFoldingRange addByParts(PCodeFoldingRange parent, PCodeFoldingRanges allFold, + int fromLine, int toLine); void insert(int index, PCodeFoldingRange range); void remove(int index); @@ -84,12 +84,11 @@ public: int linesCollapsed; // Number of collapsed lines PCodeFoldingRanges subFoldRanges; // Sub fold ranges bool collapsed; // Is collapsed? - std::weak_ptr foldRegion; // FoldRegion int hintMarkLeft; std::weak_ptr parent; bool parentCollapsed(); void move(int count); - explicit CodeFoldingRange(PCodeFoldingRange aParent, int aFromLine, PCodeFoldingDefine aFoldRegion, int aToLine); + explicit CodeFoldingRange(PCodeFoldingRange parent, int fromLine, int toLine); }; } diff --git a/libs/qsynedit/qsynedit/SynEdit.cpp b/libs/qsynedit/qsynedit/SynEdit.cpp index c8ef0e29..da07d40d 100644 --- a/libs/qsynedit/qsynedit/SynEdit.cpp +++ b/libs/qsynedit/qsynedit/SynEdit.cpp @@ -3705,7 +3705,6 @@ void SynEdit::findSubFoldRange(PCodeFoldingRanges TopFoldRanges, int FoldIndex,P Parent, TopFoldRanges, Line + 1, - mCodeFolding.foldRegions.get(FoldIndex), Line + 1); parentFoldRanges = Parent->subFoldRanges; } @@ -3734,7 +3733,6 @@ void SynEdit::findSubFoldRange(PCodeFoldingRanges TopFoldRanges, int FoldIndex,P Parent, TopFoldRanges, Line + 1, - mCodeFolding.foldRegions.get(FoldIndex), Line + 1); parentFoldRanges = Parent->subFoldRanges;