Skip to content

Commit

Permalink
working on issue #75
Browse files Browse the repository at this point in the history
  • Loading branch information
wumpz committed Apr 18, 2020
1 parent ccfc402 commit 37310e1
Showing 1 changed file with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,8 @@

import com.github.difflib.DiffUtils;
import com.github.difflib.patch.AbstractDelta;
import com.github.difflib.patch.ChangeDelta;
import com.github.difflib.patch.Chunk;
import com.github.difflib.patch.DeleteDelta;
import com.github.difflib.patch.InsertDelta;
import com.github.difflib.patch.DeltaType;
import com.github.difflib.patch.Patch;
import com.github.difflib.text.DiffRow.Tag;
import java.util.*;
Expand Down Expand Up @@ -218,7 +216,7 @@ public List<DiffRow> generateDiffRows(final List<String> original, Patch<String>
}

// Inserted DiffRow
if (delta instanceof InsertDelta) {
if (delta.getType() == DeltaType.INSERT) {
endPos = orig.last() + 1;
for (String line : rev.getLines()) {
diffRows.add(buildDiffRow(Tag.INSERT, "", line));
Expand All @@ -227,7 +225,7 @@ public List<DiffRow> generateDiffRows(final List<String> original, Patch<String>
}

// Deleted DiffRow
if (delta instanceof DeleteDelta) {
if (delta.getType() == DeltaType.DELETE) {
endPos = orig.last() + 1;
for (String line : orig.getLines()) {
diffRows.add(buildDiffRow(Tag.DELETE, line, ""));
Expand Down Expand Up @@ -312,11 +310,11 @@ private List<DiffRow> generateInlineDiffs(AbstractDelta<String> delta) {
for (AbstractDelta<String> inlineDelta : inlineDeltas) {
Chunk<String> inlineOrig = inlineDelta.getSource();
Chunk<String> inlineRev = inlineDelta.getTarget();
if (inlineDelta instanceof DeleteDelta) {
if (inlineDelta.getType() == DeltaType.DELETE) {
wrapInTag(origList, inlineOrig.getPosition(), inlineOrig
.getPosition()
+ inlineOrig.size(), Tag.DELETE, oldTag, processDiffs);
} else if (inlineDelta instanceof InsertDelta) {
} else if (inlineDelta.getType() == DeltaType.INSERT) {
if (mergeOriginalRevised) {
origList.addAll(inlineOrig.getPosition(),
revList.subList(inlineRev.getPosition(),
Expand All @@ -329,7 +327,7 @@ private List<DiffRow> generateInlineDiffs(AbstractDelta<String> delta) {
inlineRev.getPosition() + inlineRev.size(),
Tag.INSERT, newTag, processDiffs);
}
} else if (inlineDelta instanceof ChangeDelta) {
} else if (inlineDelta.getType() == DeltaType.CHANGE) {
if (mergeOriginalRevised) {
origList.addAll(inlineOrig.getPosition() + inlineOrig.size(),
revList.subList(inlineRev.getPosition(),
Expand Down

0 comments on commit 37310e1

Please sign in to comment.