From 88e953a8577fd2de75fc817305f03590799d268d Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 4 Aug 2024 22:39:11 +0100 Subject: [PATCH] Add different text highlighting for resolved changes --- src/Diff.hx | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Diff.hx b/src/Diff.hx index f32a044..4107d27 100644 --- a/src/Diff.hx +++ b/src/Diff.hx @@ -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; private var currentLine:Int = 0; @@ -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 = ""; case MergeConflictTypeEnum.INSERTED: - prefix = createColouredElement('ins', INSERTED_COLOUR, change.getIndex()); + prefix = createColouredElement('ins', change.isResolvedA() ? RESOLVED_INSERTED_COLOUR : INSERTED_COLOUR, change.getIndex()); suffix = ""; case MergeConflictTypeEnum.MODIFIED: - prefix = createColouredElement('span', MODIFIED_COLOUR, change.getIndex()); + prefix = createColouredElement('span', change.isResolvedA() ? RESOLVED_MODIFIED_COLOUR : MODIFIED_COLOUR, change.getIndex()); suffix = ""; case MergeConflictTypeEnum.CONFLICT: - prefix = createColouredElement('span', CONFLICT_COLOUR, change.getIndex()); + prefix = createColouredElement('span', change.isResolvedA() ? RESOLVED_CONFLICT_COLOUR : CONFLICT_COLOUR, change.getIndex()); suffix = ""; } @@ -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()); } }