pub fn over_provisioned_range(
viewport_top: usize,
viewport_height: usize,
line_count: usize,
) -> (usize, usize)Expand description
Compute an over-provisioned row range for ahead-of-scroll work
(syntax highlight, diagnostics gather, etc.): one viewport above +
the current viewport + one viewport below, clamped to [0, line_count).
Host-agnostic: takes only document line counts and viewport extents, no terminal cells or pixels. Future GUI hosts (floem, web, …) call the same function with their own viewport dimensions.
Returns (top, height) satisfying:
top <= viewport_toptop + height >= viewport_top + viewport_height(when room exists)top + height <= line_count(clamped at the bottom edge)height <= viewport_height * 3
Why 3×: gives the worker enough margin that a fast scroll within one viewport-height stays inside an already-parsed region. Halving (2×) is too tight in practice; quadrupling adds cost without payoff.