Skip to main content

splice_insert

Function splice_insert 

Source
pub fn splice_insert<T>(
    base: &mut Vec<Vec<T>>,
    start_line: u32,
    spans: Vec<Vec<T>>,
)
Expand description

Splice spans into base at start_line, shifting everything at or after start_line down by spans.len(). Pulled out as a pure function (rather than inlined at the drain call site) so the line-offset arithmetic — the exact thing that regressed into an in-place overwrite once already — has its own unit tests. DR.3: generic over the span type so foreground spans and intra-line refinement are shifted by ONE implementation. Two copies of this arithmetic is precisely how the two lists drift apart.