Clang: Add commentary about column convertion

... to/from utf8 byte offset used by Clang.

Change-Id: I294d6cd61b416e5f2d64206ee2f3f1b4a91fb1d3
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-01-26 17:04:38 +01:00
parent 0c50d54da7
commit fbbdfd2444
6 changed files with 20 additions and 4 deletions

View File

@@ -64,6 +64,9 @@ int positionInText(QTextDocument *textDocument,
{
auto textBlock = textDocument->findBlockByNumber(
static_cast<int>(sourceLocationContainer.line()) - 1);
// 'sourceLocationContainer' already has the CppEditor column converted from
// the utf8 byte offset from the beginning of the line provided by clang.
// - 1 is required for 0-based columns.
const int column = static_cast<int>(sourceLocationContainer.column()) - 1;
return textBlock.position() + column;
}