diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2014-01-23 22:16:43 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2014-02-04 11:33:54 +0100 |
commit | e600424648eaebe5cf3ea1fa3ae8a41a22ce7b95 (patch) | |
tree | dc72db89fdf94ee00261c21338fe9ae3e0476f74 /src/plugins/cpptools/cppcodeformatter.cpp | |
parent | fd31b4716cbc9c0be734163d599a22ac8a497b8a (diff) | |
download | qt-creator-e600424648eaebe5cf3ea1fa3ae8a41a22ce7b95.tar.gz |
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>
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 |