CppEditor: Fix "SelectBlockUp" for string literals

Literal::size() is the number of chars used internally, not necessarily
the number of logical characters.

Fixes: QTCREATORBUG-29844
Change-Id: I74431a2f3f533482567c3774f09deb44dc83d9f0
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2023-11-24 12:55:05 +01:00
parent 78329318f3
commit e2c1d12a05

View File

@@ -546,7 +546,7 @@ void CppSelectionChanger::fineTuneASTNodePositions(ASTNodePositions &positions)
// Start position will be the end position minus the size of the actual contents of the // Start position will be the end position minus the size of the actual contents of the
// literal. // literal.
int newPosStart = newPosEnd - firstToken.string->size(); int newPosStart = newPosEnd - QString::fromUtf8(firstToken.string->chars()).size();
// Skip raw literal parentheses. // Skip raw literal parentheses.
if (isRawLiteral) if (isRawLiteral)