How to design undo & redo in text editor?
问题 Part of my project is to write a text editor that is used for typing some rules, compiling my application and running it. Writing compiler was end and release beta version. In the final version we must add undo and redo to the text editor. I use a file and save it periodically for the text editor. How to design undo and redo to my text editor? What is changed in the structure of persistent of file? 回答1: You can model your actions as commands, that you keep in two stacks. One for undo, another