Skip to content

Commit

Permalink
Add different text highlighting for resolved changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mclaughlinconnor committed Aug 4, 2024
1 parent 1177133 commit 88e953a
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Diff.hx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ class Diff {
private final MODIFIED_COLOUR = "#404080";
private final CONFLICT_COLOUR = "#806000";

private final RESOLVED_DELETED_COLOUR = "#FFC0C0";
private final RESOLVED_INSERTED_COLOUR = "#C0FFC0";
private final RESOLVED_MODIFIED_COLOUR = "#DFDFFF";
private final RESOLVED_CONFLICT_COLOUR = "#FFDFC0";

private final myChanges:Array<TextMergeChange>;

private var currentLine:Int = 0;
Expand Down Expand Up @@ -66,16 +71,16 @@ class Diff {

switch (type.getType()) {
case MergeConflictTypeEnum.DELETED:
prefix = createColouredElement('del', DELETED_COLOUR, change.getIndex());
prefix = createColouredElement('del', change.isResolvedA() ? RESOLVED_DELETED_COLOUR : DELETED_COLOUR, change.getIndex());
suffix = "</del>";
case MergeConflictTypeEnum.INSERTED:
prefix = createColouredElement('ins', INSERTED_COLOUR, change.getIndex());
prefix = createColouredElement('ins', change.isResolvedA() ? RESOLVED_INSERTED_COLOUR : INSERTED_COLOUR, change.getIndex());
suffix = "</ins>";
case MergeConflictTypeEnum.MODIFIED:
prefix = createColouredElement('span', MODIFIED_COLOUR, change.getIndex());
prefix = createColouredElement('span', change.isResolvedA() ? RESOLVED_MODIFIED_COLOUR : MODIFIED_COLOUR, change.getIndex());
suffix = "</span>";
case MergeConflictTypeEnum.CONFLICT:
prefix = createColouredElement('span', CONFLICT_COLOUR, change.getIndex());
prefix = createColouredElement('span', change.isResolvedA() ? RESOLVED_CONFLICT_COLOUR : CONFLICT_COLOUR, change.getIndex());
suffix = "</span>";
}

Expand All @@ -87,13 +92,13 @@ class Diff {

switch (type.getType()) {
case(MergeConflictTypeEnum.DELETED):
return createHr(DELETED_COLOUR, change.getIndex());
return createHr(change.isResolvedA() ? RESOLVED_DELETED_COLOUR : DELETED_COLOUR, change.getIndex());
case MergeConflictTypeEnum.INSERTED:
return createHr(INSERTED_COLOUR, change.getIndex());
return createHr(change.isResolvedA() ? RESOLVED_INSERTED_COLOUR : INSERTED_COLOUR, change.getIndex());
case MergeConflictTypeEnum.MODIFIED:
return createHr(MODIFIED_COLOUR, change.getIndex());
return createHr(change.isResolvedA() ? RESOLVED_MODIFIED_COLOUR : MODIFIED_COLOUR, change.getIndex());
case MergeConflictTypeEnum.CONFLICT:
return createHr(CONFLICT_COLOUR, change.getIndex());
return createHr(change.isResolvedA() ? RESOLVED_CONFLICT_COLOUR : CONFLICT_COLOUR, change.getIndex());
}
}

Expand Down

0 comments on commit 88e953a

Please sign in to comment.