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§

FindAbilities
What a document’s find offers beyond matching text under Match case and Whole word: replacing matches, a regular expression, a byte view’s hex digits. The find’s options offer just these.
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 a find runs under: the bar’s chips, the window search’s options.
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.
FindSession
What a find over one Findable has found: how many matches, which is current, and the query and content they were found for. The FindBar keeps one, and so does the window bar’s search (crate::widget::WindowSearch): one engine, whatever draws the field.
OwnFind
A find a view ran on its own rather than through the window’s search: an action went to a match of query (an agent’s “go to result”). The window’s search shows it: its field holds the query, and it steps on from match current.

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.