forked from qt-creator/qt-creator
Utils: make column of convertPosition 0-based to merge it into Position
Change-Id: I239b3cb33b8ad59ac4097c919155ab5ca7d57b8e Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
This commit is contained in:
@@ -102,12 +102,12 @@ bool convertPosition(const QTextDocument *document, int pos, int *line, int *col
|
||||
QTextBlock block = document->findBlock(pos);
|
||||
if (!block.isValid()) {
|
||||
(*line) = -1;
|
||||
(*column) = -1;
|
||||
(*column) = 0;
|
||||
return false;
|
||||
} else {
|
||||
// line and column are both 1-based
|
||||
(*line) = block.blockNumber() + 1;
|
||||
(*column) = pos - block.position() + 1;
|
||||
(*column) = pos - block.position();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user