ClangFormat: Fix the end offset for the reformat call

The intention was to add 200 lines to the current
position, not 200 characters.

Change-Id: I5b4de24077fc354611fdeba2d6747c239a3f9d5f
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Ivan Donchevskii
2018-12-04 15:09:36 +01:00
parent dd2f8cef9d
commit 87762eb8ee

View File

@@ -203,9 +203,12 @@ Replacements replacements(const Utils::FileName &fileName,
extraOffset = Utils::Text::utf8NthLineOffset(
block->document(), buffer, block->blockNumber() - kMaxLinesFromCurrentBlock);
}
buffer = buffer.mid(extraOffset,
std::min(buffer.size(), utf8Offset + kMaxLinesFromCurrentBlock)
- extraOffset);
int endOffset = Utils::Text::utf8NthLineOffset(
block->document(), buffer, block->blockNumber() + kMaxLinesFromCurrentBlock);
if (endOffset == -1)
endOffset = buffer.size();
buffer = buffer.mid(extraOffset, endOffset - extraOffset);
utf8Offset -= extraOffset;
const int emptySpaceLength = previousEmptyLinesLength(*block);