Expand description
Pane tree (DESIGN.md §5.9 multi-buffer foundations).
v1 status (B.1.b): a recursive binary-split tree of leaf panes;
each leaf stashes per-pane viewport state (cursor + scroll) for
its content buffer. The active pane’s cursor / scroll live on
App directly so motion code keeps working unchanged –
switching the active pane snapshots the App’s fields back to the
source pane’s stash and loads the destination pane’s stash into
the App.
Splits are arbitrary: <C-w>s (horizontal) and <C-w>v
(vertical) wrap the active leaf in a new internal node. Closing
the active pane (<C-w>c) collapses it; if it had a sibling,
the parent split is replaced by the sibling so the tree stays
minimal.
Concretely the data model is a Vec<PaneState> of leaves plus a
PaneNode tree that references them by index. This avoids
lifetime gymnastics during a navigate / close walk; pane indices
are stable across the App’s lifetime (never reused, even after
close), so a stale pane index is detectable.
App lives in lattice-ui-tui (the host crate); intra-doc
links cross the crate boundary and aren’t resolvable from
lattice-core – references stay as plain code-spans.
Structs§
- Pane
Group Id - Process-monotonic id for a scroll-binding pane group (slice D.4.a,
2026-05-29) — a set of panes whose scrolling is linked, such as the two
sides of a diff. The
PaneGroupstruct itself lives inlattice-host(the trait underneath it needs host-side state); the id is hoisted intolattice-coresolattice-core-level code can hold and pass the handle without depending on the host crate. - PaneId
- Process-monotonic pane id. Distinct from
BufferId: a pane holds a buffer + viewport, but two panes can show the same buffer. Allocated byPaneId::nextat split time. - Pane
Rect - Geometry rectangle in screen coordinates. Mirrors ratatui’s
Rectshape so the renderer can hand the result straight to the layout routines without an extra conversion. - Pane
State - One leaf in the pane tree. Carries the per-pane viewport state
for its content buffer; switching the active pane swaps these
fields with
App::cursor/App::scrollso motion code stays unchanged. - Pane
Tree - The pane tree owned by
App(DESIGN.md §5.9, lives inlattice-ui-tui). v1 supports arbitrary recursive splits; the sole constraint is that the active pane must always exist (closing the last pane is a no-op so the App is never “paneless”).
Enums§
- Open
Target - Where a file-opening action should land the opened buffer.
- Pane
Direction <C-w>h/j/k/lcardinal navigation. Geometry-aware: walks the tree to find the spatial neighbour of the active pane.- Pane
Node - Internal node of the pane tree. Leaves reference a
PaneStateby index inPaneTree::leaves; splits hold two children with an explicit orientation and a ratio. New splits start atDEFAULT_SPLIT_RATIO;PaneTree::resize_active_splitandPaneTree::equalize_ratiosadjust them. - Split
Orientation - Direction the user pressed after
<C-w>to navigate or split. - Zoom
Indicator :set pane.zoom-indicator=...— where the zoom marker shows while a pane is zoomed (<C-w>z). Introduced in ZP.4.
Constants§
- DEFAULT_
SPLIT_ RATIO - Default split ratio for newly-created splits. 0.5 = even.
- MAX_
SPLIT_ RATIO - Upper clamp bound for a split ratio; see
MIN_SPLIT_RATIO. - MIN_
SPLIT_ RATIO - Clamp bounds: keep both children visible, never let one
collapse to zero. Matches vim’s
window_min_heightphilosophy. - ZOOM_
MARKER - The zoom marker itself. A plain
Z, after tmux’s window-status flag.
Traits§
- RowMapper
- Pluggable row-mapping function for a pane group (slice D.4.a).