Utils: Make column of LineColumn consistently 0-based

Change-Id: I4ab153d1c55653936efbcdc13ac04463185930e0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
David Schulz
2023-05-09 14:08:41 +02:00
parent edeea10e6a
commit 5b0c3258bb
7 changed files with 11 additions and 12 deletions

View File

@@ -60,7 +60,7 @@ OptionalLineColumn convertPosition(const QTextDocument *document, int pos)
QTextBlock block = document->findBlock(pos);
if (block.isValid())
optional.emplace(block.blockNumber() + 1, pos - block.position() + 1);
optional.emplace(block.blockNumber() + 1, pos - block.position());
return optional;
}
@@ -180,8 +180,7 @@ LineColumn utf16LineColumn(const QByteArray &utf8Buffer, int utf8Offset)
: 0;
lineColumn.column = QString::fromUtf8(
utf8Buffer.mid(startOfLineOffset, utf8Offset - startOfLineOffset))
.length()
+ 1;
.length();
return lineColumn;
}