diff --git a/libs/qsynedit/qsynedit/qsynedit.cpp b/libs/qsynedit/qsynedit/qsynedit.cpp index bb48ca69..3b9adfca 100644 --- a/libs/qsynedit/qsynedit/qsynedit.cpp +++ b/libs/qsynedit/qsynedit/qsynedit.cpp @@ -1606,10 +1606,10 @@ int QSynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent if (mSyntaxer->language() != ProgrammingLanguage::CPP) return indentSpaces; SyntaxState rangePreceeding = mDocument->getSyntaxState(startLine-1); - mSyntaxer->setState(rangePreceeding); if (addIndent) { // QString trimmedS = s.trimmed(); QString trimmedLineText = lineText.trimmed(); + mSyntaxer->setState(rangePreceeding); mSyntaxer->setLine(trimmedLineText,line-1); int statePrePre; if (startLine>1) { @@ -3336,7 +3336,7 @@ int QSynEdit::scanFrom(int Index, int canStopIndex) mSyntaxer->nextToEol(); iRange = mSyntaxer->getState(); if (Result > canStopIndex){ - if (mDocument->getSyntaxState(Result).state == iRange.state + if (mDocument->getSyntaxState(Result) == iRange && mDocument->getSyntaxState(Result).blockLevel == iRange.blockLevel && mDocument->getSyntaxState(Result).blockStarted == iRange.blockStarted && mDocument->getSyntaxState(Result).blockEnded == iRange.blockEnded diff --git a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp index da874f29..189b2965 100644 --- a/libs/qsynedit/qsynedit/syntaxer/cpp.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/cpp.cpp @@ -1571,6 +1571,11 @@ void CppSyntaxer::setLine(const QString &newLine, int lineNumber) mLineSize = mLine.size(); mLineNumber = lineNumber; mRun = 0; + mRange.blockStarted = 0; + mRange.blockEnded = 0; + mRange.blockEndedLastLine = 0; + mRange.lastUnindent=IndentInfo{IndentType::None,0}; + mRange.hasTrailingSpaces = false; next(); } diff --git a/libs/qsynedit/qsynedit/syntaxer/glsl.cpp b/libs/qsynedit/qsynedit/syntaxer/glsl.cpp index d150a87e..cb157fa0 100644 --- a/libs/qsynedit/qsynedit/syntaxer/glsl.cpp +++ b/libs/qsynedit/qsynedit/syntaxer/glsl.cpp @@ -1383,6 +1383,11 @@ void GLSLSyntaxer::setLine(const QString &newLine, int lineNumber) mLine = mLineString.data(); mLineNumber = lineNumber; mRun = 0; + mRange.blockStarted = 0; + mRange.blockEnded = 0; + mRange.blockEndedLastLine = 0; + mRange.lastUnindent=IndentInfo{IndentType::None,0}; + mRange.hasTrailingSpaces = false; next(); }