From bb5d1b706c125b9c673f105e87042d94e5eaa518 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Mon, 20 Dec 2021 08:18:43 +0800 Subject: [PATCH] work save --- RedPandaIDE/qsynedit/SynEdit.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/RedPandaIDE/qsynedit/SynEdit.cpp b/RedPandaIDE/qsynedit/SynEdit.cpp index 556b26ac..e5cf00d0 100644 --- a/RedPandaIDE/qsynedit/SynEdit.cpp +++ b/RedPandaIDE/qsynedit/SynEdit.cpp @@ -1453,21 +1453,21 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) return 0; // find the first non-empty preceeding line int startLine = line-1; - QString s; + QString startLineText; while (startLine>=1) { - s = mLines->getString(startLine-1); - if (!s.startsWith('#') && !s.trimmed().isEmpty()) { + startLineText = mLines->getString(startLine-1); + if (!startLineText.startsWith('#') && !startLineText.trimmed().isEmpty()) { break; } startLine -- ; } int indentSpaces = 0; if (startLine>=1) { - indentSpaces = leftSpaces(s); + indentSpaces = leftSpaces(startLineText); SynRangeState rangePreceeding = mLines->ranges(startLine-1); mHighlighter->setState(rangePreceeding); if (addIndent) { - QString trimmedS = s.trimmed(); +// QString trimmedS = s.trimmed(); QString trimmedLineText = lineText.trimmed(); mHighlighter->setLine(trimmedLineText,line-1); int statePrePre; @@ -1587,7 +1587,7 @@ int SynEdit::calcIndentSpaces(int line, const QString& lineText, bool addIndent) } } - if (!dontAddIndent && !s.isEmpty()) { + if (!dontAddIndent && !startLineText.isEmpty()) { BufferCoord coord; QString token; PSynHighlighterAttribute attr; @@ -2765,7 +2765,6 @@ void SynEdit::doAddChar(QChar AChar) } else if (AChar == '{' || AChar == '}' || AChar == '#') { //Reindent line when add '{' '}' and '#' at the beginning QString left = mLines->getString(oldCaretY-1).mid(0,oldCaretX-1); - qDebug()<