From d31af7f816ebc5396fc719bb37d08afda7e068f6 Mon Sep 17 00:00:00 2001 From: jess Date: Sun, 5 Apr 2026 01:03:22 -0700 Subject: [PATCH] fix invisible text and caret by setting typingAttributes explicitly --- src/EditorView.swift | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/EditorView.swift b/src/EditorView.swift index 230952a..c3e1123 100644 --- a/src/EditorView.swift +++ b/src/EditorView.swift @@ -618,6 +618,10 @@ struct EditorTextView: NSViewRepresentable { applySyntaxHighlighting(to: ts) ts.endEditing() } + textView.typingAttributes = [ + .font: Theme.editorFont, + .foregroundColor: Theme.current.text + ] updateBlockRanges(for: textView) DispatchQueue.main.async { @@ -641,10 +645,12 @@ struct EditorTextView: NSViewRepresentable { textView.selectedRanges = selectedRanges updateBlockRanges(for: textView) } - textView.font = Theme.editorFont - textView.textColor = Theme.current.text textView.backgroundColor = Theme.current.base textView.insertionPointColor = Theme.current.text + textView.typingAttributes = [ + .font: Theme.editorFont, + .foregroundColor: Theme.current.text + ] if let ruler = scrollView.verticalRulerView as? LineNumberRulerView { ruler.evalResults = evalResults @@ -672,6 +678,10 @@ struct EditorTextView: NSViewRepresentable { ts.beginEditing() applySyntaxHighlighting(to: ts) ts.endEditing() + tv.typingAttributes = [ + .font: Theme.editorFont, + .foregroundColor: Theme.current.text + ] tv.selectedRanges = sel updateBlockRanges(for: tv) rulerView?.needsDisplay = true