edit-text icon indicating copy to clipboard operation
edit-text copied to clipboard

Support undo

Open tcr opened this issue 7 years ago • 0 comments

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.

https://github.com/tcr/edit-text/blob/55003eed3ddd2307a6a28d0773bf334d5f511cc9/edit-client/src/state.rs#L274-L275

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.

tcr avatar Jul 18 '18 03:07 tcr