Skip to main content

Module history

Module history 

Source
Expand description

The editor’s undo stack: two kinds of entry on one stack.

A doc entry authors an inverse rev at the head; a view entry restores where the camera stood and which scope was open, and touches no log. Both are the same thing here — a State the editor once stood in — and one press walks to the previous one, authoring only as much of the document as the walk crosses.

The stack is an Undoer. It is fed the current state every frame and decides for itself when a change has settled into an entry, which is the coalescing rule with COALESCE as its stable_time: a camera worked continuously never settles, so a pinch leaves one entry rather than one per frame, and two moves inside the window are one press to take back.

The document half is not moved here. blockworx_doc::trail’s Trail remains what holds the steps — it is durable, and the reopened undo depth comes from it — and a state names which of its positions the document stands on through Stood. This stack is the session-level interleaving over that trail, and its own emptiness on reload is why viewing state does not survive a reload.

Modules§

undoer 🔒
An automatic undo stack fed the current state every frame.

Structs§

Consequence
What one press of undo — or of redo — would do: the thing it names, and what it costs the log. Invariant 8’s whole content.
Rename
What the container is called on either side of a step that renames it.
Selection
A selection, with the point a route was picked at.
State
One point on the stack: everywhere the editor was, as far as undo cares.
Stood
Which of the trail’s positions the document stands on: the rev whose document the head currently holds.
UndoStack

Enums§

Direction
Which way a history step goes. Two variants, so “an edit is a history step” cannot be spelled.
Kind
The kinds of entry, told apart by what taking the step crosses: a Stood boundary, a container name, or neither.
Moved
What made a state, in the words the tooltip names it by.
Naming
The container name the stack has accounted for.
Offered
Whether the session is offering a step, or drawing it dead.
Recording
Whether a frame’s own recording should happen. An undo or redo restores a state by definition, so the frame it runs in must not read the inverse commits it authored as fresh edits — which would push the step it just took straight back onto the stack.

Constants§

COALESCE
Consecutive same-type view entries inside this window are one entry. It is the Undoer’s stable_time, so it is also what makes a gesture end — rather than a gesture frame — the point an entry lands.
DEPTH 🔒
How many states the stack remembers. Past it the history panel is the surface, as it is for the log.

Functions§

consequence
What a press of undo — or of redo — will cost the log, in the sentence invariant 8 asks every such control to carry.
resolve 🔒
None when the document no longer holds what the selection names.
tool_for
The tool a restored selection resolves to — the one place that maps a selection back to the tool that holds it, so restoring and selecting cannot disagree about what “a block is selected” means.