Skip to main content

Module pane

Module pane 

Source
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§

PaneGroupId
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 PaneGroup struct itself lives in lattice-host (the trait underneath it needs host-side state); the id is hoisted into lattice-core so lattice-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 by PaneId::next at split time.
PaneRect
Geometry rectangle in screen coordinates. Mirrors ratatui’s Rect shape so the renderer can hand the result straight to the layout routines without an extra conversion.
PaneState
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::scroll so motion code stays unchanged.
PaneTree
The pane tree owned by App (DESIGN.md §5.9, lives in lattice-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§

OpenTarget
Where a file-opening action should land the opened buffer.
PaneDirection
<C-w>h/j/k/l cardinal navigation. Geometry-aware: walks the tree to find the spatial neighbour of the active pane.
PaneNode
Internal node of the pane tree. Leaves reference a PaneState by index in PaneTree::leaves; splits hold two children with an explicit orientation and a ratio. New splits start at DEFAULT_SPLIT_RATIO; PaneTree::resize_active_split and PaneTree::equalize_ratios adjust them.
SplitOrientation
Direction the user pressed after <C-w> to navigate or split.
ZoomIndicator
: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_height philosophy.
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).