C++: Fix support for incremental input with \n

Also fix false positive line continuation on blank line

e.g.
"foo \

bar"

Change-Id: Ic6d345a4b578c955411d119b8438c8dc5065c072
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Orgad Shaneh
2014-01-23 22:16:43 +02:00
committed by Orgad Shaneh
parent fd31b4716c
commit e600424648
6 changed files with 76 additions and 31 deletions

View File

@@ -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