pub fn build_preview<S: AsRef<str>>(
pattern: &FindPattern,
rows: impl Iterator<Item = S>,
replacement: &str,
current: Option<(usize, usize)>,
) -> PreviewExpand description
Build the replace preview: every match replaced, plus where each replacement landed so the renderer can colour it.
current is the buffer-coordinate (row, char_col) start of the current
match, so the span covering it can be flagged. It is passed in buffer
coordinates because that is what the editor knows; the remap to preview
coordinates happens here, where the length delta is being accumulated
anyway.
The line count never changes — the pattern cannot span a newline and the replace field is single-line — which is why callers may keep their scroll offset and row indices across a preview.