Skip to main content

Module pane_history

Module pane_history 

Source
Expand description

PBH.1: per-pane buffer history — the trail of buffers one pane has shown, walkable with <C-6> (back) / <C-7> (forward).

Design: docs/dev/architecture/pane-buffer-history.md. Sequencing: docs/dev/operations/slice-plans/pane-buffer-history.md.

This module holds the structure and its pure operations, with no Editor in sight, so the walk semantics are unit-testable without standing up an editor. The host owns the HashMap<PaneId, PaneBufferHistory> side table and the recording chokepoint (PBH.2/PBH.3).

§Why a side table rather than a field on PaneState

PaneState is Copy, and PaneTree::split_active builds the new leaf with PaneState { id: PaneId::next(), ..new_state } — a field-wise copy. A history field there would be inherited by the split, which is exactly the behaviour this feature must not have; avoiding it would mean remembering to reset that one field, and the next field added the same way would inherit the bug silently.

Keyed by PaneId in a side table the requirement holds by construction: PaneId::next() is process-monotonic and never reuses ids, so a freshly split pane has no entry and therefore no history.

Structs§

PaneBufferHistory
One pane’s buffer trail plus the walk cursor.
PaneHistoryEntry
One stop on a pane’s trail: a buffer plus where the cursor was in it in this pane.

Constants§

DEFAULT_PANE_BUFFER_HISTORY_SIZE
Default bound on one pane’s trail.