Skip to main content

Module find_bar

Module find_bar 

Expand description

Find in a document: the FindBar and the Findable capability.

A document-like view (text, code, a PDF, a hex dump, a terminal) provides Findable: it runs the query over its own content, reports the matches, scrolls one into view and paints every match with paint_find_match. The framework owns the bar: FindScope places it as a band at the top of the content it wraps and binds Ctrl+F (⌘F), Enter / Shift+Enter, F3 / Shift+F3 and Escape. A painted view that lays out its own chrome hosts a FindBar directly (FindBar::layout, draw, handle_event) and calls FindBar::drive with itself.

The bar has a counter (“3 of 12”), Match case and Whole word toggles, previous/next and one close control, and optionally a replace row, a text/hex strip and a regular-expression toggle. A view whose engine finds on its own (a web page) reports its results with FindBar::set_results and steps with Findable::step.

Structs§

FindBar
The find bar: a query field with a match counter, option chips, previous/next and close, and an optional replace row.
FindMatch
One match, as a span of the findable’s own content (a byte range of its text, or of its bytes in hex mode). The findable interprets it.
FindOptions
The options the bar’s chips set.
FindScope
Content with find: a FindBar that Ctrl+F (⌘F) opens as a band at the top of the content, driving the first Findable inside it.

Enums§

FindMode
What a find runs over: text, or a byte view’s hex digits.

Traits§

Findable
A view whose content can be searched in place.

Functions§

paint_find_match
Paint one match highlight over rect, the span of the matched glyphs — never a whole line or block. Every match is a wash of the searcher’s own selection colour; the current one is stronger and outlined so it can be told apart at a glance.
with_findable
Run visit on the first Findable in widget’s subtree; None when there is none.