forked from qt-creator/qt-creator
ClangFormat: Fix the return value for the line offset
Return -1 for the lines which do not exist in the document. Change-Id: Ieccb2121f7db260bf72b36886d1f820af01cca0d Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -142,6 +142,9 @@ QTextCursor wordStartCursor(const QTextCursor &textCursor)
|
||||
|
||||
int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffer, int line)
|
||||
{
|
||||
if (textDocument->blockCount() < line)
|
||||
return -1;
|
||||
|
||||
if (textDocument->characterCount() == buffer.size() + 1)
|
||||
return textDocument->findBlockByNumber(line - 1).position();
|
||||
|
||||
|
Reference in New Issue
Block a user