Commit 2f8c2d88 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

C++: Use Utils::transform() in BackwardsScanner



Change-Id: Iec2c2db7afd8e5fe463a32c6b5167592cdd7617c
Reviewed-by: default avatarLaurent Montel <laurent.montel@kdab.com>
Reviewed-by: Nikolai Kosjar's avatarNikolai Kosjar <nikolai.kosjar@qt.io>
parent 01b2ed79
......@@ -27,6 +27,8 @@
#include <cplusplus/Token.h>
#include <utils/algorithm.h>
#include <QTextCursor>
#include <QTextDocument>
......@@ -75,12 +77,11 @@ const Token &BackwardsScanner::fetchToken(int tokenIndex)
_text.prepend(QLatin1Char('\n'));
_text.prepend(blockText);
Tokens adaptedTokens;
for (int i = 0; i < _tokens.size(); ++i) {
Token t = _tokens.at(i);
t.utf16charOffset += blockText.length() + 1;
adaptedTokens.append(t);
}
const int offset = blockText.length() + 1;
const Tokens adaptedTokens = Utils::transform(_tokens, [offset](Token token) {
token.utf16charOffset += unsigned(offset);
return token;
});
_tokens = _tokenize(blockText, previousBlockState(_block));
_offset += _tokens.size();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment