Commit 6894cd0b authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

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.
parent 40bc1ac0
......@@ -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();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment