From d68e9e1a4d6b7b72a9ab0cfcfbbd3901e32594c0 Mon Sep 17 00:00:00 2001 From: Christian Kamm <christian.d.kamm@nokia.com> Date: Wed, 15 Sep 2010 11:12:32 +0200 Subject: [PATCH] C++ indenter: Fix curly brace placement for ANSI style. There was a bug in 5cd6ebfdfd94aa9745f2ca8e92c5ed24d6bc1afa which meant no reindent of the current line was triggered for the opening curly brace on a new line. Task-number: QTCREATORBUG-2331 --- src/plugins/cpptools/cppcodeformatter.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index c88e422135e..b242f6c490d 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -477,6 +477,11 @@ void CodeFormatter::indentForNewLineAfter(const QTextBlock &block, int *indent, restoreCurrentState(block); *indent = m_indentDepth; *padding = m_paddingDepth; + + int lexerState = loadLexerState(block); + m_tokens.clear(); + m_currentLine.clear(); + adjustIndent(m_tokens, lexerState, indent, padding); } void CodeFormatter::updateStateUntil(const QTextBlock &endBlock) -- GitLab