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:
@@ -190,5 +190,15 @@ void setLastSentDocumentRevision(const QString &filePath, uint revision)
|
||||
document->sendTracker().setLastSentRevision(int(revision));
|
||||
}
|
||||
|
||||
int clangColumn(const QString &lineText, int cppEditorColumn)
|
||||
{
|
||||
// (1) cppEditorColumn is the actual column shown by CppEditor.
|
||||
// (2) The return value is the column in Clang which is the utf8 byte offset from the beginning
|
||||
// of the line.
|
||||
// Here we convert column from (1) to (2).
|
||||
// '+ 1' is for 1-based columns
|
||||
return lineText.left(cppEditorColumn).toUtf8().size() + 1;
|
||||
}
|
||||
|
||||
} // namespace Utils
|
||||
} // namespace Clang
|
||||
|
||||
Reference in New Issue
Block a user