Skip to main content

Module search

Module search 

Source
Expand description

Headless find & replace engine (literal and regex search, single-undo batch replace).

Structs§

SearchQuery
A headless find query: literal substring or regex, with case and whole-word toggles. Compiled to a [regex::Regex] on use.
SearchState
Version-cached search state for interactive find (prompt, vim /).

Functions§

collect_replacements
Collects (range, expanded_text) pairs for query in text, with 0-based ascending ranges.
compile_query
Compiles a SearchQuery into a [regex::Regex].
find_matches
Returns all match byte ranges for query in buffer, in ascending order.
find_next
Returns the first match at or after from_offset, wrapping to the start when wrap is set. Returns Ok(None) when there are no matches.
find_prev
Returns the last match at or before from_offset, wrapping to the end when wrap is set. Returns Ok(None) when there are no matches.
replace_all_query
Replaces all matches of query with replacement as a single undoable transaction. Supports $1 / $name capture expansion in regex mode; literal mode uses replacement verbatim. Returns the number of replacements applied.
replace_one_query
Replaces the single match range with replacement (undoable).