diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index c88e422135e9a2ab6defec8b26ac9a78286027bb..b242f6c490d74d8c0c43312702fbfd0fe420aa92 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)