diff options
author | Orgad Shaneh <orgad.shaneh@audiocodes.com> | 2014-03-26 18:54:04 +0200 |
---|---|---|
committer | Orgad Shaneh <orgads@gmail.com> | 2014-03-31 18:18:42 +0200 |
commit | aeb2cfbc4fe7685550fb6b10ef7146c98c19e821 (patch) | |
tree | 0b21d11d1806a976636a010e3cd963f586c5acc8 /src/plugins/cpptools/cppcodeformatter.cpp | |
parent | 5416557a0b9247e911180a7cce4a5ed3b0c0f351 (diff) | |
download | qt-creator-aeb2cfbc4fe7685550fb6b10ef7146c98c19e821.tar.gz |
CppTools: Fix indentation for concatenated strings
Change-Id: I801a56804e7873be75a9ebc085dc3f4a2d64ea35
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r-- | src/plugins/cpptools/cppcodeformatter.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodeformatter.cpp b/src/plugins/cpptools/cppcodeformatter.cpp index c2ac2fb88d..9ee2fa8815 100644 --- a/src/plugins/cpptools/cppcodeformatter.cpp +++ b/src/plugins/cpptools/cppcodeformatter.cpp @@ -564,6 +564,13 @@ void CodeFormatter::recalculateStateAfter(const QTextBlock &block) case cpp_macro_cont: break; + case string_open: + if (!m_currentToken.isStringLiteral()) { + leave(); + continue; + } + break; + default: qWarning() << "Unhandled state" << m_currentState.top().type; break; @@ -819,6 +826,9 @@ bool CodeFormatter::tryExpression(bool alsoExpression) break; } + if (m_currentToken.isStringLiteral()) + newState = string_open; + if (newState != -1) { if (alsoExpression) enter(expression); @@ -1425,6 +1435,11 @@ void QtStyleCodeFormatter::onEnter(int newState, int *indentDepth, int *savedInd case cpp_macro_cont: *indentDepth = m_tabSettings.m_indentSize; break; + + case string_open: + *indentDepth = tokenPosition; + *paddingDepth = 0; + break; } // ensure padding and indent are >= 0 |