From e2c1d12a05d7726ed32056584b22c5b10df6613e Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 24 Nov 2023 12:55:05 +0100 Subject: [PATCH] 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 --- src/plugins/cppeditor/cppselectionchanger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cppeditor/cppselectionchanger.cpp b/src/plugins/cppeditor/cppselectionchanger.cpp index 7b9f6767451..3d31893311b 100644 --- a/src/plugins/cppeditor/cppselectionchanger.cpp +++ b/src/plugins/cppeditor/cppselectionchanger.cpp @@ -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 // literal. - int newPosStart = newPosEnd - firstToken.string->size(); + int newPosStart = newPosEnd - QString::fromUtf8(firstToken.string->chars()).size(); // Skip raw literal parentheses. if (isRawLiteral)