Skip to main content

context_slice

Function context_slice 

Source
pub fn context_slice(
    snap: &RangeSnapshots,
    old_path: &str,
    new_path: &str,
    old_start: u32,
    new_start: u32,
    count: u32,
) -> Result<Vec<Line>, ModelError>
Expand description

Unchanged lines shared by a file’s two endpoint snapshots — what the page’s expand-context control reveals inside hunk gaps. Returns up to count Line::Ctx rows starting at old_start/new_start (1-based, pre- and post-image), clamped at either file’s end. The requested region must be text-identical at both endpoints — a gap between hunks always is — so expansion can never invent or hide a change; a mismatch is rejected loudly. old_path/new_path may differ (renamed files).