-
Notifications
You must be signed in to change notification settings - Fork 0
SourceGutter
The Source Gutter: the presentation-only margin strip drawn to the left of the
Source Panel's TextBox. It shows a Line Number for each visible
source line of the Markdown Document, mirroring the Source Panel's own line layout and scroll
position.
-
Class:
UI.Controls.SourceGutter(derives fromSystem.Windows.Controls.Canvas) -
Default style:
src/UI/Controls/SourceGutter.xaml(merged inApp.xaml)
Authored as a custom Control (class plus a ResourceDictionary for its look), per the project's Control exception to the zero-code-behind rule. The gutter is view-only: it reads the Source Panel's line layout and mirrors it, and never mutates the document — so it cannot change the Markdown source (INV-014). It is the Source Panel counterpart of the EditorGutter, which serves the Visual Document.
The gutter positions its numbers from TextBox.GetRectFromCharacterIndex, which reports each line's
position relative to the Source Panel's viewport. It re-lays out whenever the Source Panel's text,
size, or scroll offset changes (via TextChanged, SizeChanged, and the bubbled
ScrollViewer.ScrollChangedEvent), so the numbers stay aligned as the user types and scrolls.
The Source Panel is set to TextWrapping="NoWrap", so each source line occupies exactly one rendered
row. A Line Number here is therefore the 1-based ordinal of a source line. Only the lines currently
within the viewport (GetFirstVisibleLineIndex … GetLastVisibleLineIndex) are walked and drawn.
| Property | Type | Description |
|---|---|---|
Source |
TextBox? |
The Source Panel TextBox whose source lines this gutter mirrors. Setting it wires the refresh subscriptions. |
LineNumberBrush |
Brush |
Brush for Line Numbers. Themed to MutedTextBrush. |
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<controls:SourceGutter Grid.Column="0" Source="{Binding ElementName=SourcePanel}" />
<TextBox Grid.Column="1" x:Name="SourcePanel" TextWrapping="NoWrap"
Text="{Binding ActiveSession.Markdown, UpdateSourceTrigger=PropertyChanged, Delay=120}" />
</Grid>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