Skip to main content

Module undo

Module undo 

Source
Expand description

Delta-based undo with SSD spill + optional on-close persistence.

Memory model (replaces full-buffer snapshots that grew O(edits × file)):

  • each history entry is a line-range delta (changed lines only)
  • one full snapshot (last, Arc-shared) anchors the live end of the chain
  • only the newest IN_RAM_MAX deltas stay in RAM; older ones spill to ~/.xei/undo/<fnv(path)>.undo and stream back in on deep undo
  • undo_caching = true keeps the spill file on close (plus a .meta content hash) so reopening the same, unchanged file resumes its history; false (default) deletes it

The public API mirrors the old snapshot stack (push the pre-edit state, undo/redo exchange full snapshots) so call sites stay untouched.

Structs§

UndoStack

Constants§

IN_RAM_MAX
Newest deltas kept in RAM; older ones go to the spill file.