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§
- Find
Abilities - 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.
- 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 a find runs under: the bar’s chips, the window search’s options.
- Find
Scope - Content with find: a
FindBarthat Ctrl+F (⌘F) opens as a band at the top of the content, driving the firstFindableinside it. - Find
Session - What a find over one
Findablehas found: how many matches, which is current, and the query and content they were found for. TheFindBarkeeps 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 matchcurrent.
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.