FindMyFiles
FindMyFiles.Highlighting
CompiledHighlighter Class
A query compiled into the positive text needles worth highlighting. Pure (no WinUI), so it is unit-testable and reusable across rows. Built once per query by Compile(string) and queried per displayed string by Ranges(string, HighlightField).
Highlighting deliberately mirrors only the *simple, certain* slice of the
engine's match semantics (fmf-core query/): plain substrings, anchored
lit*/*lit/*lit* wildcards, and smart-case folding
(engine/crates/fmf-core/src/wtf8.rs). Anything the UI cannot reproduce
exactly — user regex, general wildcards, negation, path wildcards — is left
un-highlighted rather than guessed at: a row the engine returned is never
hidden, only its emphasis is skipped (don't crash / don't go silent). This guarantees
the UI never lights up a position the engine did not actually match.
public sealed class CompiledHighlighter : FindMyFiles.Highlighting.IHighlighter
Inheritance System.Object → CompiledHighlighter
Implements IHighlighter
Fields
CompiledHighlighter.Empty Field
A highlighter with no terms — every Ranges(string, HighlightField) call returns empty. Used for empty/filter-only queries.
public static readonly CompiledHighlighter Empty;
Field Value
Properties
CompiledHighlighter.IsEmpty Property
True when nothing will ever be highlighted — the caller can skip per-row work entirely.
public bool IsEmpty { get; }
Implements IsEmpty
Property Value
Methods
CompiledHighlighter.Ranges(string, HighlightField) Method
The ranges of text matched by the terms targeting field, sorted by start and with overlapping/adjacent runs merged. Indices/lengths are UTF-16 units of text itself, ready to slice. Empty when nothing matches (or the query has no terms for this field).
public System.Collections.Generic.IReadOnlyList<FindMyFiles.Highlighting.HighlightRange> Ranges(string text, FindMyFiles.Highlighting.HighlightField field);
Parameters
text System.String
The displayed string (a name, or a full path).
field HighlightField
Which term family to apply.
Implements Ranges(string, HighlightField)
Returns
System.Collections.Generic.IReadOnlyList<HighlightRange>
The sorted, merged highlight ranges; empty when nothing matches.