Guide

Share one geometry snapshot.

Derive regions from the current terminal size. Use the same immutable geometry for rendering, hit testing, and cursor placement.

Resize from terminal events.

Flyology_TUI.Events reports terminal resize. Store the current width and height in the application model. Resize retained components before deriving the next presentation.

Zero-width and zero-height regions are normal at small sizes. Do not route input or show a cursor for a hidden region.

Keep rendering and routing aligned.

Flyology_TUI.Geometry provides signed points and rectangles. Layout components return immutable presentations or snapshots with exact visible regions.

Build one snapshot per update or presentation boundary. Route the related mouse event with that snapshot. Do not recompute a different layout between hit testing and rendering.

Localize mouse coordinates.

Flyology_TUI.Mouse converts terminal coordinates into component-local events. Route topmost overlays first. Route events for caller-owned child regions before container events.

Scrollbars are stateful controls, not decoration. The application synchronizes viewport offset and scrollbar position in both directions.

Release capture reliably.

A press can request mouse capture. Route later drag and matching release events to the capture owner, even outside its old bounds.

A resize, disable, or structural change can cancel a gesture. The application must retain capture until it routes the matching release. The release then clears capture.