Skip to content
This repository was archived by the owner on Feb 24, 2018. It is now read-only.
This repository was archived by the owner on Feb 24, 2018. It is now read-only.

Undo / redo #9

@rr-

Description

@rr-

Self-explanatory.

A basic idea for implementation is to keep a list of text removals and text insertions. Each operation that changes text would produce two artifacts: what to do with the current state to reach the target state, and what to do with the target state to reach the current state.

Traversing the list shouldn't remove states, i.e. do not make this a stack. Otherwise redoing operations won't be possible.

On the other hand, appending states to the list should cut off the current branch:

  • Current undo buffer state:
    Operation 1 - Operation 2 - Operation 3
  • undo happens
    Current undo buffer state:
    Operation 1 - Operation 2 - Operation 3
  • undo happens
    Current undo buffer state:
    Operation 1 - Operation 2 - Operation 3
  • the document is edited
    Current undo buffer state:
    Operation 1 - Operation 4 (operation 2 and 3 were freed from the memory)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions