Skip to main content

Crate neco_history

Crate neco_history 

Source
Expand description

Tree-based edit history with undo, redo, branching, and checkpointing.

This crate provides EditHistory, a text-editing history that records edits as nodes in a neco_tree::CursoredTree. When the user undoes and then makes a new edit, a new branch is created instead of discarding the old timeline.

Two recording modes are supported:

  • EntryKind::Reversible: stores forward and inverse TextPatches. Inverse patches are derived automatically from the current text and the forward patches.
  • EntryKind::Snapshot: stores a complete text snapshot. Use this for operations where computing a delta is impractical (e.g. external file reload).

Periodic checkpoints (full snapshots) are inserted automatically so that jump_to can reach distant nodes efficiently.

Structs§

EditHistory
Tree-structured edit history with cursor-based undo/redo.
HistoryEntry
Data stored in each history node.
RedoResult
Information returned by EditHistory::redo.
UndoResult
Information returned by EditHistory::undo.

Enums§

EntryKind
Determines how an edit can be undone/redone.
JumpStep
A single step in a EditHistory::jump_to path.