forked from qt-creator/qt-creator
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:
@@ -203,9 +203,12 @@ Replacements replacements(const Utils::FileName &fileName,
|
|||||||
extraOffset = Utils::Text::utf8NthLineOffset(
|
extraOffset = Utils::Text::utf8NthLineOffset(
|
||||||
block->document(), buffer, block->blockNumber() - kMaxLinesFromCurrentBlock);
|
block->document(), buffer, block->blockNumber() - kMaxLinesFromCurrentBlock);
|
||||||
}
|
}
|
||||||
buffer = buffer.mid(extraOffset,
|
int endOffset = Utils::Text::utf8NthLineOffset(
|
||||||
std::min(buffer.size(), utf8Offset + kMaxLinesFromCurrentBlock)
|
block->document(), buffer, block->blockNumber() + kMaxLinesFromCurrentBlock);
|
||||||
- extraOffset);
|
if (endOffset == -1)
|
||||||
|
endOffset = buffer.size();
|
||||||
|
|
||||||
|
buffer = buffer.mid(extraOffset, endOffset - extraOffset);
|
||||||
utf8Offset -= extraOffset;
|
utf8Offset -= extraOffset;
|
||||||
|
|
||||||
const int emptySpaceLength = previousEmptyLinesLength(*block);
|
const int emptySpaceLength = previousEmptyLinesLength(*block);
|
||||||
|
Reference in New Issue
Block a user