pub fn window(current: usize, total: usize, around: usize) -> Vec<Slot>Expand description
The pages to show for current of total, keeping around either side.
Pages are 1-based here, unlike the indices everywhere else in this
crate: a page number is a label a person reads, not an offset into a slice,
and a paginator that can say “page 0” is a bug waiting to be filed. current
out of range is clamped rather than trusted — it arrives from a caller’s
state, and a paint is no place to panic.
Two rules earn their tests. A gap that hides exactly one page is worse than the page, so that page is shown instead; an ellipsis standing for a single number tells you less while taking the same room. And the window slides at the ends rather than shrinking, so walking to the last page does not narrow the control under the pointer — the same refusal to reflow as the focus ring’s reserved border and the calendar’s six fixed rows.