Skip to main content

Module find

Module find 

Source
Expand description

Searching a document’s text: where the matches are, which one is current, and what a flow needs to draw them.

A match is a range of characters in one paragraph’s flat text, the string odox_core::edit::text answers and the page editor’s offsets count in, so the same range lights up the same characters whether the paragraph is being read or edited. What a match is found in is the view’s business; this module knows only how to look in a string and how to keep the results. Case is not significant, and the query is not a pattern. DESIGN.md §11.

Structs§

Found
What a view keeps of a search: the matches, which one is current, and whether the view still owes a scroll to it.
Highlights
The matches a flow draws behind its text.
Match
One place a query was found.
Replaced
What a replace did: how many matches were replaced, and how many were left as they were because what holds them cannot take text.

Functions§

in_paragraphs
Every match of a query in the paragraphs under a root, in the order the flow draws them, tagged with a scope.
ranges
Where a query occurs in a text, as character ranges that do not overlap. An empty query occurs nowhere.
replace_ranges
A text with some ranges of it, counted in characters and not overlapping, replaced by another text.