DiffEditor: Fix newline handling for not the last chunk

Task-number: QTCREATORBUG-12665
Change-Id: I7a54fa5502d3e06c6e1ccd99dec800f80e217333
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2014-07-28 12:17:31 +03:00
parent 7d3d80a6d5
commit 4c7f1c5ea9
2 changed files with 1 additions and 2 deletions

View File

@@ -775,7 +775,6 @@ void DiffEditor::Internal::DiffEditorPlugin::testReadPatch()
QCOMPARE(resultChunkData.leftStartingLineNumber, origChunkData.leftStartingLineNumber); QCOMPARE(resultChunkData.leftStartingLineNumber, origChunkData.leftStartingLineNumber);
QCOMPARE(resultChunkData.rightStartingLineNumber, origChunkData.rightStartingLineNumber); QCOMPARE(resultChunkData.rightStartingLineNumber, origChunkData.rightStartingLineNumber);
QCOMPARE(resultChunkData.contextChunk, origChunkData.contextChunk); QCOMPARE(resultChunkData.contextChunk, origChunkData.contextChunk);
QEXPECT_FAIL("2 chunks - first ends with blank line", "QTCREATORBUG-12665", Abort);
QCOMPARE(resultChunkData.rows.count(), origChunkData.rows.count()); QCOMPARE(resultChunkData.rows.count(), origChunkData.rows.count());
for (int k = 0; k < origChunkData.rows.count(); k++) { for (int k = 0; k < origChunkData.rows.count(); k++) {
const RowData &origRowData = origChunkData.rows.at(k); const RowData &origRowData = origChunkData.rows.at(k);

View File

@@ -604,7 +604,7 @@ static QList<RowData> readLines(const QString &patch,
} else { } else {
if (noNewLineInEqual >= 0) { if (noNewLineInEqual >= 0) {
removeNewLineFromLastEqual = true; removeNewLineFromLastEqual = true;
} else if (lastChunk) { } else {
if (lastEqual > lastDelete && lastEqual > lastInsert) { if (lastEqual > lastDelete && lastEqual > lastInsert) {
removeNewLineFromLastEqual = true; removeNewLineFromLastEqual = true;
} else if (lastDelete > lastEqual && lastDelete > lastInsert) { } else if (lastDelete > lastEqual && lastDelete > lastInsert) {