forked from qt-creator/qt-creator
Utils: Move common positionInText function to Utils::Text
Change-Id: I5d74a73058ca457b0fb3f13eaf945f224d5699fb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -58,6 +58,13 @@ Utils::OptionalLineColumn convertPosition(const QTextDocument *document, int pos
|
||||
return optional;
|
||||
}
|
||||
|
||||
int positionInText(QTextDocument *textDocument, int line, int column)
|
||||
{
|
||||
// Deduct 1 from line and column since they are 1-based.
|
||||
// Column should already be converted from UTF-8 byte offset to the TextEditor column.
|
||||
return textDocument->findBlockByNumber(line - 1).position() + column - 1;
|
||||
}
|
||||
|
||||
QString textAt(QTextCursor tc, int pos, int length)
|
||||
{
|
||||
if (pos < 0)
|
||||
|
||||
Reference in New Issue
Block a user