Skip to main content

fold_aware_visible_end

Function fold_aware_visible_end 

Source
pub fn fold_aware_visible_end(
    fold_idx: &FoldIndex,
    scroll: u32,
    height: u32,
    total_lines: u32,
) -> u32
Expand description

The exclusive buffer-line bound a height-row viewport starting at scroll actually reaches.

height counts display rows; the answer counts buffer lines, and a closed fold is exactly where those two stop being the same number. Collapse an org file and 60 rows can reach 2500 lines in. Anything sized to the band a viewport covers — the syntax parse window, the cell matrix’s chunk window — must ask for this rather than scroll + height, or it stops one screenful of lines down while the screen keeps painting past it.

A viewport ending on a closed fold head returns the bound past that fold’s whole body. The body has no rows, so this only ever makes a caller’s range a superset of what it strictly needs; it also means consecutive callers agree with the head row’s own extent.

total_lines is CONTENT space, for the reason spelled out on visible_source_lines.