DiffEditorPlugin: Various cleanups

Change-Id: Ic0c9c397067b899932bc39d938e63df36fa4caeb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-09-27 15:13:33 +02:00
parent e67e2121a7
commit 0def7c83d4
13 changed files with 91 additions and 120 deletions

View File

@@ -304,7 +304,7 @@ QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData
DiffSelections *selections)
{
if (chunkData.contextChunk)
return QString();
return {};
QString diffText;
int leftLineCount = 0;
@@ -341,8 +341,7 @@ QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData
'-',
lineData.text,
lastChunk,
i == chunkData.rows.count()
&& j == leftBuffer.count() - 1);
i == chunkData.rows.count() && j == leftBuffer.count() - 1);
const int blockDelta = line.count('\n'); // no new line
// could have been added
@@ -351,10 +350,8 @@ QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData
for (auto it = lineData.changedPositions.cbegin(),
end = lineData.changedPositions.cend(); it != end; ++it) {
const int startPos = it.key() < 0
? 1 : it.key() + 1;
const int endPos = it.value() < 0
? it.value() : it.value() + 1;
const int startPos = it.key() < 0 ? 1 : it.key() + 1;
const int endPos = it.value() < 0 ? it.value() : it.value() + 1;
(*selections)[*blockNumber + blockCount + 1].append(
DiffSelection(startPos, endPos, input.m_leftCharFormat));
}
@@ -382,8 +379,7 @@ QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData
'+',
lineData.text,
lastChunk,
i == chunkData.rows.count()
&& j == rightBuffer.count() - 1);
i == chunkData.rows.count() && j == rightBuffer.count() - 1);
const int blockDelta = line.count('\n'); // no new line
// could have been added
@@ -393,10 +389,8 @@ QString UnifiedDiffData::setChunk(const DiffEditorInput &input, const ChunkData
for (auto it = lineData.changedPositions.cbegin(),
end = lineData.changedPositions.cend(); it != end; ++it) {
const int startPos = it.key() < 0
? 1 : it.key() + 1;
const int endPos = it.value() < 0
? it.value() : it.value() + 1;
const int startPos = it.key() < 0 ? 1 : it.key() + 1;
const int endPos = it.value() < 0 ? it.value() : it.value() + 1;
(*selections)[*blockNumber + blockCount + 1].append
(DiffSelection(startPos, endPos, input.m_rightCharFormat));
}