QM™ supports undoing and redoing of all actions that change the model in any way, such as:
After a model is created, opened, or saved to disk, the model is marked as “clean”.
Any editing action changes the model status to “edited”, which shows as a star after the model name in the QM's title bar.
The model can become "clean" again after the undo actions bring it back to the original state.
QM™ keeps track of all model editing actions in the undo/redo stack, which operates as follows.
Every model edit action is pushed on top of the undo/redo stack. If there are any undoable actions above the current top of stack, all these actions get discarded, so that the most recent action sits at the top of stack.
The Undo command reverses the effect of the action pointed to by the "top of stack" and moves the top of the stack one level toward the older actions. As long as any editing actions are available for undoing, the undo command is enabled both in the Edit Menu as well as in the Edit Toolbar. The Undo command is also available under the standard keyboard shortcut Ctrl+Z.
The Redo command moves the top of the stack one level toward the newer actions and re-applies the action pointed to by the new "top of stack". As long as any actions are available above the current "top of stack", the redo command is enabled both in the Edit Menu as well as in the Edit Toolbar. The Redo command is also available under the standard keyboard shortcut Ctrl+Y.
The value of undo/redo is high for recent editing actions, but diminishes quickly for older actions that are pushed down the undo/redo stack. Because the value of the old actions is very low, there is not much use to keep all the undo actions forever. Therefore the depth of the QM™ undo stack is limited, currently to 16 levels of undo.
QM™ uses text editors extensively to edit action code associated with state machines, to edit files for code generation, and to edit the documentation. The undo/redo feature works for editing text as expected, whereas you can undo each individual edit. However, as soon as you apply an editing action outside of the current text editor, the QM™ undo stack collapses all these editing actions into just one edit.