-
Notifications
You must be signed in to change notification settings - Fork 0
FindHighlightAdorner
317jamtay317 edited this page Jul 23, 2026
·
2 revisions
The FindHighlightAdorner draws the Find highlights over the
MarkdownRichEditor's Visual Document: a translucent fill behind every
Match, with the Current Match filled more strongly and outlined. It is the visible half of Find; the
matching itself is the pure MatchFinder.
-
Class:
UI.Controls.FindHighlightAdorner(derives fromSystem.Windows.Documents.Adorner) -
Attached by:
MarkdownRichEditoronLoaded, into the editor'sAdornerLayer.
Find is split so that only the editor Control touches the document:
-
The editor computes.
MarkdownRichEditorbuilds a plain-text snapshot of the Visual Document (concatenating text runs, with a separator inserted at block boundaries so a Match never bridges two blocks), runsMatchFinderover it, and maps each Match back to aTextRange. It tracks which Match is the Current Match and exposesMatchCount/MatchSummaryfor the Find Bar. -
The adorner draws. The editor calls
Updatewith the Match ranges and the Current Match index;OnRenderpaints a rounded fill behind each on-screen Match, using a stronger fill and an outline for the Current Match.SetColorslets the editor pass palette-derived brushes so the highlights follow the light/dark theme.
- Repaint (cheap). Scrolling and resizing only repaint from the ranges already held — they never re-run the search. Off-screen and wrapped Matches are skipped rather than painted.
-
View-only (INV-016). The adorner is presentation-only (
IsHitTestVisible = false) and only ever draws. Neither it nor the Find state on the editor feeds back into Capture, so finding, highlighting, and moving the Current Match never change the Markdown Document. Replacing a Match does edit (INV-022), but that is the editor's ownReplace/Replace All— the adorner is not involved, and simply repaints from the fresh ranges afterwards. -
Stale pointers. When the document is replaced the editor recomputes the ranges; a repaint that
races that replacement swallows the resulting
InvalidOperationExceptionand waits for the fresh ranges.
LiveMarkDownEditor
User guide
- Getting Started
- Writing and Formatting
- Tables
- Diagrams
- Files, Folders and Tabs
- Finding and Navigating
- Panels and Layout
- Live Updates and Conflicts
- Pages, Printing and Export
- Spell Check
- Keyboard Shortcuts
Controls
- MarkdownRichEditor
- PageView
- DocumentSheetBackdrop
- PrintPreviewPages
- EditorGutter
- SourceGutter
- OutlinePanel
- FolderPanel
- PanelHeader
- PanelColumn
- CommandBarPanel
- CommandTip
- FindHighlightAdorner
- SpellCheckAdorner
- CodeShadingAdorner
- ChangeHighlightAdorner
- MermaidPreview
- MermaidDiagramView
- DiagramCanvas
- VideoPlayerView