diff options
author | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-10-17 11:00:24 +0200 |
---|---|---|
committer | Ivan Donchevskii <ivan.donchevskii@qt.io> | 2018-10-24 12:23:49 +0000 |
commit | 918713a059d06c3b9a570223dbbf6a9e5b2986c9 (patch) | |
tree | 78061a27419a137e3e6c3eaba0731e18f1f7046c /src/libs | |
parent | 075ead9cd99a47c1ce189de0f599d7a7b54e763c (diff) | |
download | qt-creator-918713a059d06c3b9a570223dbbf6a9e5b2986c9.tar.gz |
ClangFormat: Make more readable helper functions
Change-Id: I25828a17104a778d4be156bf2a2879cefbd08691
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/utils/textutils.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/libs/utils/textutils.cpp b/src/libs/utils/textutils.cpp index c05e6cce84..d102de794a 100644 --- a/src/libs/utils/textutils.cpp +++ b/src/libs/utils/textutils.cpp @@ -145,14 +145,14 @@ int utf8NthLineOffset(const QTextDocument *textDocument, const QByteArray &buffe if (textDocument->characterCount() == buffer.size() + 1) return textDocument->findBlockByNumber(line - 1).position(); - int pos = 0; + int utf8Offset = 0; for (int count = 0; count < line - 1; ++count) { - pos = buffer.indexOf('\n', pos); - if (pos == -1) - return -1; - ++pos; + utf8Offset = buffer.indexOf('\n', utf8Offset); + if (utf8Offset == -1) + return -1; // The line does not exist. + ++utf8Offset; } - return pos; + return utf8Offset; } } // Text |