Undo/Redo implementation

后端 未结 10 1369
醉酒成梦
醉酒成梦 2020-11-28 18:59

Give me some thoughts how to implement undo/redo functionality - like we have in text editors. What algorithms should I use and what I may read. thanks.

10条回答
  •  攒了一身酷
    2020-11-28 19:28

    The Memento pattern was made for this.

    Before implementing this yourself, note that this is quite common, and code already exist - For example, if you're coding in .Net, you can use IEditableObject.

提交回复
热议问题