fix: seed code-block cache on programmatic document load
updateCodeBlockSelection was only ever called from the two AppKit text-delegate callbacks (textDidChange / selection-changed), never from the programmatic rebuildTextStorageAndStyle load path. Line number gutters (and the built-in copy-code button) stayed empty on a cold document open until the user's first click or keystroke. Threads the rebuild's own parsed document into the same call instead of leaving cachedCodeBlockTokens empty until the next real edit.
This commit is contained in:
+7
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user