FindState
State management for the Find feature.
Parameters
The TextEditorState to search within
CoroutineScope for handling text change reactions
Properties
Whether matches are limited to the selection captured by toggleInSelection. The scope follows edits; if its text is deleted or the document replaced, this turns off. An undo that brings back text the scope covered brings the scope back with it, and turns this back on if the deletion had turned it off.
Whether query is a regular expression that does not compile; it then finds nothing.
Functions
Clear the search - remove all highlights and reset state.
Navigate to the previous match.
Replace all matches with the given text, each taking the styling at the start of the text it replaces. Matches are found afresh in the current text; where matches overlap, only the first is replaced.
Replace the current match with the given text and move to the next match. The replacement takes the styling at the start of the text it replaces.
Toggle case sensitivity and re-run search if there's an active query.
Limit matches to the current selection, or search the whole document again. While the selection is a match this session selected, or there is none, the user's last own selection is used instead, as long as the only edits since were this session's replacements. Enabling does nothing when there is no such selection.
Toggle regular expression matching and re-run search if there's an active query. See isInvalidPattern.
Toggle whole-word matching and re-run search if there's an active query.