Undo/Redo

Updated Mar 14, 2026

Gauss maintains separate history stacks for:

  • Document changes (Cmd+Z / Ctrl+Z, Cmd+Y / Ctrl+Y): Shape creation, movement, deletion, style changes
  • Selection changes (Cmd+Shift+Z / Ctrl+Shift+Z, Cmd+Shift+Y / Ctrl+Shift+Y): What is currently selected

Tool mode switches and edge-mode toggles are editor-state changes and do not create document undo entries. Manipulate-mode segment-kind toggles are document edits and therefore produce document undo entries.

This allows selection changes to be undone without affecting the document, and vice versa. For example, after selecting several shapes and then undoing the selection, the shapes themselves remain unchanged.

Document history is now owned internally by the engine state. Shortcuts and visible undo/redo behaviour are unchanged.

Single undo step per gesture: Each user gesture — whether a drag, a click in draw mode, a style change, or a keyboard command — produces exactly one undo step. For example, dragging a shape (even if multiple shapes are selected) creates a single entry; pressing Undo once restores all shapes to their pre-drag positions. During drag, preview movement does not create history entries; history is updated only when the gesture commits.

Grouped compound operations: Some operations execute multiple internal commands. Gauss groups these commands into one document-history entry, so one Undo reverts the whole operation rather than partially reverting it. Grouped entries are only committed when the operation closes successfully. Invalid grouped-history boundaries are rejected atomically, so failed grouped undo/redo interactions do not partially commit document changes or history entries.

Historical undo behaviour: Document undo uses historical undo — all commands remain navigable even after branching. For example, if actions A, B are performed, then B is undone, and C is performed, undoing C will redo B in the historical sequence rather than discarding it. This means work is never lost through undo/redo branching.