diff options
author | jkobus <jaroslaw.kobus@digia.com> | 2014-11-06 13:23:40 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@theqtcompany.com> | 2014-11-21 10:08:36 +0100 |
commit | 8d1940a7964a27c32f3a1f8f637f28511f6360a6 (patch) | |
tree | 9427537dec87ca246abb4832f71f338fb95682b0 /src/plugins/diffeditor/diffutils.cpp | |
parent | 07e3a032ff04ab1af665819baf267bcc80463d0b (diff) | |
download | qt-creator-8d1940a7964a27c32f3a1f8f637f28511f6360a6.tar.gz |
Replace old svn diff editor with the new one
Change-Id: I4137b709be718603cdc221ac938e139326c88835
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins/diffeditor/diffutils.cpp')
-rw-r--r-- | src/plugins/diffeditor/diffutils.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/plugins/diffeditor/diffutils.cpp b/src/plugins/diffeditor/diffutils.cpp index 3f9c43a20d..fdfb548fdf 100644 --- a/src/plugins/diffeditor/diffutils.cpp +++ b/src/plugins/diffeditor/diffutils.cpp @@ -540,8 +540,11 @@ static QList<RowData> readLines(const QString &patch, int i; for (i = 0; i < lines.count(); i++) { const QString line = lines.at(i); - if (line.isEmpty()) - break; // need to have at least one character (1 column) + if (line.isEmpty()) { // need to have at least one character (1 column) + if (lastChunk) + i = lines.count(); // pretend as we've read all the lines (we just ignore the rest) + break; + } QChar firstCharacter = line.at(0); if (firstCharacter == QLatin1Char('\\')) { // no new line marker if (!lastChunk) // can only appear in last chunk of the file @@ -567,14 +570,17 @@ static QList<RowData> readLines(const QString &patch, } } else { Diff::Command command = Diff::Equal; - if (firstCharacter == QLatin1Char(' ')) // common line + if (firstCharacter == QLatin1Char(' ')) { // common line command = Diff::Equal; - else if (firstCharacter == QLatin1Char('-')) // deleted line + } else if (firstCharacter == QLatin1Char('-')) { // deleted line command = Diff::Delete; - else if (firstCharacter == QLatin1Char('+')) // inserted line + } else if (firstCharacter == QLatin1Char('+')) { // inserted line command = Diff::Insert; - else - break; // no other character may exist as the first character + } else { // no other character may exist as the first character + if (lastChunk) + i = lines.count(); // pretend as we've read all the lines (we just ignore the rest) + break; + } Diff diffToBeAdded(command, line.mid(1) + newLine); |