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 VecLayoutNode so a single
algorithm computes pixel rects for both apps.
Structs§
- Split
Ratio - The fraction of a split’s area allotted to side
a, refined so that the illegal values have no representation.
Enums§
- Layout
Error - Why a
LayoutNodefailedLayoutNode::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). - Layout
Kind - Named tmux-style layout presets. tmux ships five built-ins; tear
supports the same plus a
tatami-style auto-balance. - Layout
Node - One node in a window’s layout tree.
- Leaf
Removal - 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).