Skip to main content

Module scroll

Module scroll 

Source
Expand description

Shared scroll helpers for components with selectable / overflowing lists (S2 stamps, S6 peers, S9 tags). Components track a usize offset alongside their selected index; this module bundles the “keep selected visible” math + the right-edge scrollbar render.

Each helper is pure where possible so unit tests can exercise the offset arithmetic without spinning up a Frame.

Functions§

clamp_scroll
Recompute scroll_offset so selected is inside the visible_rows window. Pure — no Frame access.
render_scrollbar
Render the right-edge scrollbar over area if the list overflows. Silently no-ops when every row already fits — that’s the common case (most operators have <8 batches / <30 peers / <5 tags).