diff --git a/Vendor/swift-markdown-engine/Sources/MarkdownEngine/TextView/Coordinator/NativeTextViewCoordinator+Restyling.swift b/Vendor/swift-markdown-engine/Sources/MarkdownEngine/TextView/Coordinator/NativeTextViewCoordinator+Restyling.swift index 7133867..4b3c152 100644 --- a/Vendor/swift-markdown-engine/Sources/MarkdownEngine/TextView/Coordinator/NativeTextViewCoordinator+Restyling.swift +++ b/Vendor/swift-markdown-engine/Sources/MarkdownEngine/TextView/Coordinator/NativeTextViewCoordinator+Restyling.swift @@ -185,6 +185,13 @@ extension NativeTextViewCoordinator { previousActiveTokenIndices = activeTokenIndices previousCaretLocation = finalSelection.location previousSelectedRange = finalSelection + + // FIX: seed cachedCodeBlockTokens on the programmatic load path too — + // it was previously only populated by the AppKit text-delegate + // callbacks (textDidChange / selection-changed), so code-block + // overlays (line-number gutters, the built-in copy button) stayed + // empty on a cold document open until the user's first keystroke. + updateCodeBlockSelection(textView: textView, parsed: parsed) } // Reconcile wide-table overlays after layout settles.