tcr/edit-text

Support undo

Opened this issue · 0 comments

tcr commented

If OT::apply were to have a sibling method OT::apply_reversable(...) which returned a tuple (Doc, reverse_op), where reverse_op applied to Doc would result in the inverse method, then undo could be possible.

// TODO Generate an "undo" version of the operation and store it.
// This should come from the Op::apply above.

Here the undo would be generated, and then attached to the self object. Each time an operation is performed, this undo is replaced (or queued, for multiple-level undo) or if we have incoming packets, the undo packet is transformed against the incoming packet.