forked from qt-creator/qt-creator
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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user