summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp
index c88e422135..b242f6c490 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)