The Command pattern is a software design pattern which can be used to implement Multi-level Undo. The Memento pattern is useful for capturing the state of the program before user actions.
This can be used for state reversal needed in some undo implementations.