Undo-Redo of an Editor
1 State
- Complete capture ("core" dump?) of the process (program in
execution)
- Includes state of files …
- Includes global and all levels of local variables …
- Time stamped, when discussing specs
- Compact representation: a major design issue
2 State History
2.1 State History of a variable X
- Sequences of values that X ever held from big-bang to current
- Each value is time stamped. The time stamp is "abstract", it is
not in units/sub-units of seconds. Every time state changes we
move from time t to t+1.
2.2 Operations of the Editor
- Every Op at t moves St to a "new" state St+1 at t+1
- Every Op is completely recorded: Name, and arguments
- LOP ::= Last Operation, and we use LOPt [subscript t] when needed
3 Spec of Undo
- Suppose the last operation was LOP that mapped state St to St+1.
- The relationship between St and St+1 is given by the semantics
of LOP; notationally, St+1 := LOP(St).
- Undo maps St+1 to St+2, so that St+2 == St.
- In the absence of History, Undo is a no-op, mapping St+1 to
St+2, so that St+2 == St+1.
- Note the growth of History as with other Ops.
- Semantics of Undo depends on LOP.
- Undo is a higher-order function.
4 Spec of Redo
- Suppose St+1 := LOPt(St)
- Redo at t+1 maps St+1 to St+2, St+2 := Redo(St+1), so
that St+2 is related to St+1 in "a manner similar" to how
St+1 and St were. That is, St+2 := LOPt(St+1)
- Understand the case: The last operation may be an Undo
- Understand the case: The last operation may be a Redo
5 Design of Undo/Redo
- Mostly: Representation of State History
- Usually: Not undoing/redoing "entire" state
- Main design goal: Compact. It is too easy to be exorbitantly large.
- Main design goal: Speed. It is too easy to become slow.
5.1 Representation of State
- Current state, St: Easy .. trivial
- Last state, St-1:
- Obvious: a dump of then-current state
- Can be heavily space consuming
- last-state := current-state plus-minus changes
- last-state := LOPt-inverse(current-state), sometimes the
LOP-inverse is an easy to compute function
5.2 Representation of State History
- Sequence of state values, conceptually
- Sequence of LOP-inverse's
7 References
- Meyer, Bertrand. Object-Oriented Software Construction. New York:
Prenticehall, 1988.
- http://en.wikipedia.org/wiki/Undo. Not so good. Even so …
Recommended Reading.
- Edwards, W. Keith, Takeo Igarashi, Anthony LaMarca, and Elizabeth
D. Mynatt. "A Temporal Model for Multi-Level Undo and Redo",
Proceedings of the 13th annual ACM symposium on User Interface
Software and Technology (UIST), 2000.
https://research.cc.gatech.edu/ecl/sites/edu.ecl/files/C.29-Edwards-UIST-2000.pdf
Highly Recommended Reading.
- James O'Brien, and Marc Shapiro. "Undo for anyone, anywhere,
anytime." In Proceedings of the 11th workshop on ACM SIGOPS
European workshop, p. 31. ACM, 2004. Recommended Reading.
- Merlino, Hernán, Oscar Dieste, Patricia Pesado, and Ramón
García-Martínez. "Software as a Service: Undo." In SEKE,
pp. 328-332. 2012.
http://www.unla.edu.ar/sistemas/gisi/GISI/papers/SEKE-Merlino.pdf
Recommended Reading.
- Alessandro Warth, Yoshiki Ohshima, Ted Kaehler, and Alan Kay,
"Worlds: Controlling the Scope of Side Effects",
European Conference on Object-Oriented Programming, 2011.
Recommended Reading.
Copyright © 2018 •
www.wright.edu/~pmateti 2018-10-15