Correctly Deal with Identity Changes and Divergent History #5

Merged
kske merged 3 commits from b/divergent-history into develop 2021-12-24 22:16:46 +01:00
Owner
  • Identity changes are now immediately discarded by the change manager.
  • addChange returns whether the change was actually added or discarded.
  • When "overwriting" the history by adding change after performing an undo, the new change is added at the correct position and the divergent history is discarded.
* Identity changes are now immediately discarded by the change manager. * `addChange` returns whether the change was actually added or discarded. * When "overwriting" the history by adding change after performing an undo, the new change is added at the correct position and the divergent history is discarded.
kske self-assigned this 2021-12-22 15:53:38 +01:00
kske added 2 commits 2021-12-22 15:53:39 +01:00
Fix javafx module artifact name
All checks were successful
zdm/undo-redo/pipeline/head This commit looks good
1155541350
Discard identity changes, discard divergent branches
All checks were successful
zdm/undo-redo/pipeline/head This commit looks good
5d1ef84770
kske requested review from delvh 2021-12-22 15:53:43 +01:00
kske requested review from mpk 2021-12-22 15:53:43 +01:00
delvh started working 2021-12-22 16:52:08 +01:00
delvh reviewed 2021-12-22 17:06:46 +01:00
@ -16,2 +18,4 @@
private int markedIndex = -1;
/**
* @implNode As this change manager uses a linear history model, all changes behind the last

I can definitely see needing this Javadoc more often.
What about implementing a superclass called LinearHistoryChangeManager that automatically supplies the Javadoc and general implementations of functions (undo, redo, and addChange given a new protected abstract function removeDivergentChanges)?

I can definitely see needing this Javadoc more often. What about implementing a superclass called `LinearHistoryChangeManager` that automatically supplies the Javadoc and general implementations of functions (`undo`, `redo`, and `addChange` given a new protected abstract function `removeDivergentChanges`)?
Author
Owner

I think we need to create more change manager implementations before deciding what belongs in the superclass and what doesn't. In any case, this branch is probably the wrong place add this.

I think we need to create more change manager implementations before deciding what belongs in the superclass and what doesn't. In any case, this branch is probably the wrong place add this.
delvh marked this conversation as resolved
@ -103,0 +124,4 @@
manager.addChange(change);
manager.undo();
assertTrue(manager.addChange(new IntChange(wrapper, 2)));
assertFalse(manager.isRedoAvailable());

Perhaps you should
a) test by adding two changes that are undone
b) Add an assertSame for the size of changes stored

Perhaps you should a) test by adding two changes that are undone b) Add an assertSame for the size of changes stored
Author
Owner

Good point. I actually discovered a bug through this. The fix is coming in the next commit.

Good point. I actually discovered a bug through this. The fix is coming in the next commit.
kske marked this conversation as resolved
delvh stopped working 2021-12-22 17:06:48 +01:00
14min 40s
kske added 1 commit 2021-12-23 08:42:38 +01:00
Fix divergent changes removal, improve unit test
All checks were successful
zdm/undo-redo/pipeline/head This commit looks good
d484839c8b
delvh approved these changes 2021-12-23 14:18:42 +01:00
kske merged commit 4a70d954ef into develop 2021-12-24 22:16:46 +01:00
kske deleted branch b/divergent-history 2021-12-24 22:16:46 +01:00
This repo is archived. You cannot comment on pull requests.
No reviewers
No Milestone
No Assignees
2 Participants
Total Time Spent: 14 minutes 40 seconds
delvh
14 minutes 40 seconds
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: zdm/undo-redo#5
No description provided.