Skip to main content

build_context_lines

Function build_context_lines 

Source
pub fn build_context_lines(
    all_lines: &[&str],
    match_idx: usize,
    before_ctx: usize,
    after_ctx: usize,
) -> (Vec<String>, Vec<String>)
Expand description

Helper to build context slices for a match line. DRY for search impls (library + CLI).

Exposed for downstreams that want consistent context extraction (#815).

Accepts asymmetric context sizes (before_ctx, after_ctx). For symmetric context pass the same value for both.