Skip to main content

Module render

Module render 

Source
Expand description

Terminal-dependent layout, viewport management, drawing, and hit testing.

Renderer stores widget outputs in key order. During Renderer::render it reads the current terminal size, wraps or truncates every logical content row, allocates vertical viewports, scrolls each keyed viewport just enough to include its cursor, and delegates the resulting visible rows to the terminal.

Empty items and items with max_height == Some(0) do not occupy space. Ordered-content items are allocated in key order while reserving at least one row for every non-empty item. The remaining height is shared equally between items using crate::HeightPolicy::FairContent or crate::HeightPolicy::FairFill. Fair-content items stop at their content height without redistributing their unused share, while fair-fill items pad their content to preserve the allocated area. A terminal that cannot provide one row per non-empty item produces an error.

A successful render saves a layout snapshot. Renderer::hit_test and Renderer::screen_position always use that snapshot, so event handling maps positions against what was actually drawn rather than against newer, not-yet-rendered content.

Structs§

PreparedLayout
A renderer frame after wrapping, viewport allocation, and clipping.
Renderer
Renderer stores widget content, lays it out, and draws it to a terminal.
RendererLayout
Terminal-size-dependent renderer layout without terminal I/O.

Type Aliases§

SharedRenderer
SharedRenderer is a type alias for an Arc-wrapped Renderer, allowing for shared ownership and concurrency.