diff options
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodeformatter.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index db557959be..08d5188945 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -70,7 +70,8 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) restoreCurrentState(block.previous()); bool endedJoined = false; - const int lexerState = tokenizeBlock(block, &endedJoined); + // Discard newline expected bit from state + const int lexerState = tokenizeBlock(block, &endedJoined) & ~0x80; m_tokenIndex = 0; m_newStates.clear(); @@ -504,7 +505,7 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) leave(); continue; } else if (m_tokenIndex == m_tokens.size() - 1 - && lexerState == T_EOF_SYMBOL) { + && lexerState == 0) { leave(); } else if (m_tokenIndex == 0 && m_currentToken.isComment()) { // to allow enter/leave to update the indentDepth |