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.
- Find
Match - 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.
- Find
Options - The options the bar’s chips set.
- Find
Scope - Content with find: a
FindBarthat Ctrl+F (⌘F) opens as a band at the top of the content, driving the firstFindableinside it.
Enums§
- Find
Mode - 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
visiton the firstFindableinwidget’s subtree;Nonewhen there is none.