fix invisible text and caret by setting typingAttributes explicitly

This commit is contained in:
jess 2026-04-05 01:03:22 -07:00
parent 1d5e7b7c0e
commit d31af7f816
1 changed files with 12 additions and 2 deletions

View File

@ -618,6 +618,10 @@ struct EditorTextView: NSViewRepresentable {
applySyntaxHighlighting(to: ts) applySyntaxHighlighting(to: ts)
ts.endEditing() ts.endEditing()
} }
textView.typingAttributes = [
.font: Theme.editorFont,
.foregroundColor: Theme.current.text
]
updateBlockRanges(for: textView) updateBlockRanges(for: textView)
DispatchQueue.main.async { DispatchQueue.main.async {
@ -641,10 +645,12 @@ struct EditorTextView: NSViewRepresentable {
textView.selectedRanges = selectedRanges textView.selectedRanges = selectedRanges
updateBlockRanges(for: textView) updateBlockRanges(for: textView)
} }
textView.font = Theme.editorFont
textView.textColor = Theme.current.text
textView.backgroundColor = Theme.current.base textView.backgroundColor = Theme.current.base
textView.insertionPointColor = Theme.current.text textView.insertionPointColor = Theme.current.text
textView.typingAttributes = [
.font: Theme.editorFont,
.foregroundColor: Theme.current.text
]
if let ruler = scrollView.verticalRulerView as? LineNumberRulerView { if let ruler = scrollView.verticalRulerView as? LineNumberRulerView {
ruler.evalResults = evalResults ruler.evalResults = evalResults
@ -672,6 +678,10 @@ struct EditorTextView: NSViewRepresentable {
ts.beginEditing() ts.beginEditing()
applySyntaxHighlighting(to: ts) applySyntaxHighlighting(to: ts)
ts.endEditing() ts.endEditing()
tv.typingAttributes = [
.font: Theme.editorFont,
.foregroundColor: Theme.current.text
]
tv.selectedRanges = sel tv.selectedRanges = sel
updateBlockRanges(for: tv) updateBlockRanges(for: tv)
rulerView?.needsDisplay = true rulerView?.needsDisplay = true