From d11af4511bce3726e0e938b1594b0603d8f45e98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com> Date: Wed, 16 Sep 2009 16:16:45 +0200 Subject: [PATCH] Fixed brace depth level to allow negative numbers Done with mae. --- src/plugins/cppeditor/cpphighlighter.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/plugins/cppeditor/cpphighlighter.cpp b/src/plugins/cppeditor/cpphighlighter.cpp index d2cda6f77df..03a4701b210 100644 --- a/src/plugins/cppeditor/cpphighlighter.cpp +++ b/src/plugins/cppeditor/cpphighlighter.cpp @@ -108,10 +108,8 @@ void CppHighlighter::highlightBlock(const QString &text) } else if (tk.is(T_RPAREN) || tk.is(T_RBRACE) || tk.is(T_RBRACKET)) { const QChar c(tk.text().at(0)); parentheses.append(Parenthesis(Parenthesis::Closed, c, tk.position())); - if (tk.is(T_RBRACE)) { - if (--braceDepth < 0) - braceDepth = 0; - } + if (tk.is(T_RBRACE)) + --braceDepth; } bool highlightCurrentWordAsPreprocessor = highlightAsPreprocessor; @@ -228,7 +226,7 @@ void CppHighlighter::highlightBlock(const QString &text) if (currentState != -1) { oldState = currentState & 0xff; oldBraceDepth = currentState >> 8; - block.setUserState(qMax(0, (oldBraceDepth + delta) << 8 ) | oldState); + block.setUserState(((oldBraceDepth + delta) << 8 ) | oldState); } block = block.next(); } -- GitLab