forked from qt-creator/qt-creator
CppTools: Do not indent within string literals
Multi-line strings must be kept as the user wrote them. Fixes: QTCREATORBUG-20180 Change-Id: I141eff52b55d31215e6f5c6c5a0e026689db877a Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -635,7 +635,6 @@ void CodeFormatter::updateStateUntil(const QTextBlock &endBlock)
|
||||
break;
|
||||
if (loadLexerState(it) == -1)
|
||||
break;
|
||||
|
||||
previousState = blockData.m_endState;
|
||||
}
|
||||
|
||||
@@ -673,6 +672,16 @@ void CodeFormatter::updateLineStateChange(const QTextBlock &block)
|
||||
saveBlockData(&next, BlockData());
|
||||
}
|
||||
|
||||
bool CodeFormatter::isInStringLiteral(const QTextBlock &block) const
|
||||
{
|
||||
if (!block.previous().isValid())
|
||||
return false;
|
||||
BlockData blockData;
|
||||
if (!loadBlockData(block.previous(), &blockData))
|
||||
return false;
|
||||
return !blockData.m_endState.isEmpty() && blockData.m_endState.top().type == string_open;
|
||||
}
|
||||
|
||||
CodeFormatter::State CodeFormatter::state(int belowTop) const
|
||||
{
|
||||
if (belowTop < m_currentState.size())
|
||||
|
||||
Reference in New Issue
Block a user