Multi-Window Undo Validation
Closed this issue · 1 comments
rjkroege commented
Undo actions can affect multiple windows in Edwood. This needs better testing to be sure that the file.Buffer
work (#97) doesn't regress. Completing this issue entails fixing the noted issues and creating tests that show correct behaviour.
Context
- Create at least 2 Window objects a and b with underlying Text etc.
- Each Window is backed by an on disk file (needed for some tests.)
Cases
Simple multi-undo
- Mutate a, b simultaneously (via Edit command) on a
- Undo correctly undoes both mutations from either a, b
- Redo correctly redoes both mutations from either a, b
Branched a
- Mutate a, b simultaneously
- Mutate a
- Undo a only undoes mutation 2
Branched b
- Mutate a, b simultaneously
- Mutate a
- Undo b only undoes the first (simultaneous) mutation.
Branched and rejoined (and rebranched a)
- Mutate a, b simultaneously
- Mutate a
- Undo b (undoes 1 in b)
- Undo a (undoes 2)
- Undo b does nothing
- Undo a (undoes 1)
- Redo on a,b applies 1 to both
- Redo on a applies 2 to a
File Name Change with Mutli
- Change a's name to c
- Mutate c, b simultaneously (via Edit command) on c
- Undo or c,b removes 2 from ca and b, a remains having a different file
- Undo returns c to a
- Redo makes a back to c
- Undo makes c back into a
The 5 to 6 transition is wrong: it takes two Undo actions. This is a persistent fault. Hypothesis: seq
is being incremented one additional time somewhere.
File Name Change
- Change a's name to c (note that currently the cursor position is wrong in the title bar after the Undo action.) (I think that this is a regression that I caused when I removed
mod
.) - Mutate c
- Put c
- Undo 2 (c becomes puttable)
- Undo 1 (c's name becomes a). a is puttable. Arguably, a should not now be puttable because it's unmodified compared to the disk version. Perhaps track the
putseq
in the undo record when the file name is changed? This might overlay with #372.