summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodeformatter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/cpptools/cppcodeformatter.cpp')
-rw-r--r--src/plugins/cpptools/cppcodeformatter.cpp15
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