Skip to main content

Module layout

Module layout 

Source
Expand description

Binary-tree layout for a window’s panes.

Every crate::TearWindow holds exactly one LayoutNode — either a leaf (a single pane) or an internal node that splits the window into two children with a given orientation. The recursive structure mirrors how operators reason about tmux/screen panes: “split this pane to my right, then split the bottom-half down”.

mado’s existing pane.rs/tab.rs uses a flat Vec; the eventual M5 rebase swaps that for LayoutNode so a single algorithm computes pixel rects for both apps.

Structs§

SplitRatio
The fraction of a split’s area allotted to side a, refined so that the illegal values have no representation.

Enums§

LayoutError
Why a LayoutNode failed LayoutNode::validate. Every variant names a structurally-illegal tree so the invariant violation is a typed value, not a silent mis-render (UNREPRESENTABILITY: a tree that fails to validate never reaches the renderer).
LayoutKind
Named tmux-style layout presets. tmux ships five built-ins; tear supports the same plus a tatami-style auto-balance.
LayoutNode
One node in a window’s layout tree.
LeafRemoval
Outcome of LayoutNode::remove_leaf. Removing a pane either collapses its parent split into the surviving sibling, removes the only pane (leaving nothing the tree can represent — the caller must close the window), or finds no such pane.
Size
Size specification for a pane within a layout.

Constants§

MIN_RATIO
Minimum fraction a side of a split may hold — keeps a resize from collapsing a pane to nothing while still letting the cell arithmetic squeeze it (a 2-cell window splits 1/1 regardless).