diff options
author | Thorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com> | 2009-11-23 15:15:56 +0100 |
---|---|---|
committer | con <qtc-committer@nokia.com> | 2009-11-23 17:20:29 +0100 |
commit | d6b770586d9b13eae66d33c550c5aba8009541a3 (patch) | |
tree | 5b2544d01b57d45fffadb7a93e05e0080f78646f | |
parent | c2f36acb7c09fbcb2b09d1a493a9f69887e4176e (diff) |
Fixed a potential issue with automatic brace matching
When encountering a line that hasn't been highlighted yet, we need to
abort the optimization for changing brace depth.
Done with Roberto Raggi and mae.
(cherry picked from commit 6894cd0b2ee5c788db407435f947d0128bc54c98)
-rw-r--r-- | src/plugins/cppeditor/cpphighlighter.cpp | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index b2db7a8e42..ebc670db3e 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -48,8 +48,6 @@ CppHighlighter::CppHighlighter(QTextDocument *document) : void CppHighlighter::highlightBlock(const QString &text) { - QTextCharFormat emptyFormat; - const int previousState = previousBlockState(); int state = 0, initialBraceDepth = 0; if (previousState != -1) { @@ -225,7 +223,7 @@ void CppHighlighter::highlightBlock(const QString &text) if (oldState == tokenize.state() && oldBraceDepth != braceDepth) { int delta = braceDepth - oldBraceDepth; QTextBlock block = currentBlock().next(); - while (block.isValid()) { + while (block.isValid() && block.userState() != -1) { TextEditDocumentLayout::changeBraceDepth(block, delta); block = block.next(); } |