Skip to main content

collect_replacements

Function collect_replacements 

Source
pub fn collect_replacements(
    text: &str,
    query: &SearchQuery,
    replacement: &str,
) -> Result<Vec<(Range<usize>, String)>, EditorError>
Expand description

Collects (range, expanded_text) pairs for query in text, with 0-based ascending ranges.

Ranges are non-empty and on char boundaries. Supports $1 / $name capture expansion in regex mode; literal mode uses replacement verbatim. replace_all_query applies these to a whole buffer; line-scoped substitutes (:s without %) collect on a line slice and offset the ranges by the line start.