Expand description
Axis-aligned rectangles — the geometry the layout algebra renders to.
A Rect is the bounding box a crate::LayoutNode subtree is
allotted. The unit is the caller’s: tear-core measures in terminal
cells (cols × rows), mado scales the same rects to device pixels for
the GPU. One crate::LayoutNode::compute_rects algorithm serves
both — so a split looks identical whether the daemon is sizing a PTY
winsize or mado is drawing pane borders. That single-renderer
property is the whole reason this type lives in tear-types and not
in either app (the compounding directive’s “solve once” rule).
Cells are u16 — a terminal never exceeds 65535 cols/rows, and the
width/height of a child is always ≤ its parent, so no arithmetic here
overflows. Division is gap-free and overlap-free by construction:
a split hands side a a clamped extent and side b the exact
remainder, so a.right() == b.x (or a.bottom() == b.y) always —
there is no representable layout with a one-cell seam or a one-cell
double-draw.
Structs§
- Rect
- An axis-aligned rectangle in a discrete cell grid.
x/yare the top-left origin;w/hare width/height. A zero-area rect is legal (it models a pane squeezed out of a too-small window) butRect::is_emptyflags it so renderers can skip it.