Fix newline handling in diff editor

Task-number: QTCREATORBUG-12618
Change-Id: If2a30ff4efdc106f43e2ea77d2783ea797e92722
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
jkobus
2014-07-09 12:37:47 +02:00
committed by Jarek Kobus
parent 89b8c9d523
commit c9c4f05fee
3 changed files with 200 additions and 53 deletions

View File

@@ -478,13 +478,24 @@ QString UnifiedDiffEditorWidget::showChunk(const ChunkData &chunkData,
(*selections)[*blockNumber].append(DiffSelection(&m_chunkLineFormat));
int lastEqualRow = -1;
if (lastChunk) {
for (int i = chunkData.rows.count(); i > 0; i--) {
if (chunkData.rows.at(i - 1).equal) {
if (i != chunkData.rows.count())
lastEqualRow = i - 1;
break;
}
}
}
for (int i = 0; i <= chunkData.rows.count(); i++) {
const RowData &rowData = i < chunkData.rows.count()
? chunkData.rows.at(i)
: RowData(TextLineData(TextLineData::Separator)); // dummy,
// ensure we process buffers to the end.
// rowData will be equal
if (rowData.equal) {
if (rowData.equal && i != lastEqualRow) {
if (leftBuffer.count()) {
for (int j = 0; j < leftBuffer.count(); j++) {
const TextLineData &lineData = leftBuffer.at(j);