From 766bf62c04b055cfdf55e491a1509ef56b262bb8 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Fri, 17 Feb 2023 18:29:23 +0800 Subject: [PATCH] show "..." instead of "...}" when folding #if/#endif --- libs/qsynedit/qsynedit/qsynedit.cpp | 34 ++++++++++++++++++----------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index f5fe145e..39bf3de0 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -1919,7 +1919,7 @@ void QSynEdit::endEditing() if (mEditingCount==0) { if (!mUndoing) mUndoList->endBlock(); - rescanRanges(); + reparseDocument(); } decPaintLock(); } @@ -3354,7 +3354,7 @@ void QSynEdit::scanFrom(int index) return ; } -void QSynEdit::rescanRange(int line) +void QSynEdit::reparseLine(int line) { if (!mSyntaxer) return; @@ -3374,7 +3374,7 @@ void QSynEdit::rescanRange(int line) mDocument->setSyntaxState(line,iRange); } -void QSynEdit::rescanRanges() +void QSynEdit::reparseDocument() { if (mSyntaxer && !mDocument->empty()) { mSyntaxer->resetState(); @@ -3458,6 +3458,7 @@ void QSynEdit::foldOnListCleared() void QSynEdit::rescanFolds() { + //qDebug()<endUpdate(); }); - rescanRanges(); + reparseDocument(); } onSizeOrFontChanged(true); invalidate(); @@ -5312,6 +5313,7 @@ void QSynEdit::doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionM } } QStringList deleted=getContent(startPos,endPos,mode); + beginEditingWithoutUndo(); switch(mode) { case SelectionMode::Normal: if (mDocument->count() > 0) { @@ -5320,18 +5322,11 @@ void QSynEdit::doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionM // the selection mark. QString TempString = mDocument->getLine(startPos.line - 1).mid(0, startPos.ch - 1) + mDocument->getLine(endPos.line - 1).mid(endPos.ch-1); -// bool collapsed=foldCollapsedBetween(BB.Line,BE.Line); // Delete all lines in the selection range. mDocument->deleteLines(startPos.line, endPos.line - startPos.line); properSetLine(startPos.line-1,TempString); UpdateMarks = true; internalSetCaretXY(startPos); -// if (collapsed) { -// PSynEditFoldRange foldRange = foldStartAtLine(BB.Line); -// if (!foldRange -// || (!foldRange->collapsed)) -// uncollapseAroundLine(BB.Line); -// } } break; case SelectionMode::Column: @@ -5378,6 +5373,7 @@ void QSynEdit::doDeleteText(BufferCoord startPos, BufferCoord endPos, SelectionM // Update marks if (UpdateMarks) doLinesDeleted(startPos.line, endPos.line - startPos.line + MarkOffset); + endEditingWithoutUndo(); if (!mUndoing) { mUndoList->addChange(ChangeReason::Delete, startPos, @@ -5478,7 +5474,7 @@ int QSynEdit::doInsertTextByNormalMode(const BufferCoord& pos, const QStringList str = sLeftSide + text[0] + sRightSide; properSetLine(caretY - 1, str); } - rescanRange(caretY); + reparseLine(caretY); // step2: insert remaining lines of Value for (int i=1;i