From e2391574c86005ab5cd4dd2e7561e82369fcb989 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Mon, 28 Mar 2022 11:50:52 +0200 Subject: [PATCH] CppEditor: Prevent indenting inside all variants of raw string literals Fixes: QTCREATORBUG-27244 Change-Id: Icda903bf572081278af34078e4f6243747a7b7ab Reviewed-by: Christian Stenger Reviewed-by: Reviewed-by: Qt CI Bot --- src/plugins/cppeditor/cppcodeformatter.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppcodeformatter.cpp b/src/plugins/cppeditor/cppcodeformatter.cpp index e806dab1a8a..00884aba141 100644 --- a/src/plugins/cppeditor/cppcodeformatter.cpp +++ b/src/plugins/cppeditor/cppcodeformatter.cpp @@ -825,8 +825,11 @@ bool CodeFormatter::tryExpression(bool alsoExpression) break; } - if (m_currentToken.isStringLiteral()) - newState = m_currentToken.kind() == T_RAW_STRING_LITERAL ? raw_string_open : string_open; + if (m_currentToken.isStringLiteral()) { + newState = m_currentToken.kind() >= T_FIRST_RAW_STRING_LITERAL + && m_currentToken.kind() <= T_LAST_RAW_STRING_LITERAL ? raw_string_open + : string_open; + } if (newState != -1) { if (alsoExpression)