ClangFormat: Fix utf8 symbol indentation

Fixes: QTCREATORBUG-29927
Change-Id: I5a5a326e13cbe3a874a66e275ded0c6dea9964d7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Artem Sokolovskii
2023-12-08 11:49:01 +01:00
parent 2f49c0830e
commit ee75c7276b
3 changed files with 21 additions and 2 deletions

View File

@@ -316,8 +316,10 @@ int forceIndentWithExtraText(QByteArray &buffer,
// A comment at the end of the line appears to prevent clang-format from removing line breaks.
if (dummyText == "/*//*/" || dummyText.isEmpty()) {
if (block.previous().isValid()) {
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(), buffer,
block.blockNumber()) + block.previous().text().length();
const int prevEndOffset = Utils::Text::utf8NthLineOffset(block.document(),
buffer,
block.blockNumber())
+ block.previous().text().toUtf8().length();
buffer.insert(prevEndOffset, " //");
extraLength += 3;
}