reapply eval spacing after syntax highlighting in all code paths
This commit is contained in:
parent
fef2935ae5
commit
c326903e84
|
|
@ -1233,6 +1233,7 @@ struct EditorTextView: NSViewRepresentable {
|
|||
applySyntaxHighlighting(to: ts, format: fileFormat)
|
||||
ts.endEditing()
|
||||
}
|
||||
textView.applyEvalSpacing()
|
||||
textView.typingAttributes = [
|
||||
.font: Theme.editorFont,
|
||||
.foregroundColor: Theme.current.text
|
||||
|
|
@ -1310,6 +1311,7 @@ struct EditorTextView: NSViewRepresentable {
|
|||
ts.beginEditing()
|
||||
applySyntaxHighlighting(to: ts, format: parent.fileFormat)
|
||||
ts.endEditing()
|
||||
(tv as? LineNumberTextView)?.applyEvalSpacing()
|
||||
tv.needsDisplay = true
|
||||
})
|
||||
observers.append(NotificationCenter.default.addObserver(
|
||||
|
|
@ -1348,6 +1350,7 @@ struct EditorTextView: NSViewRepresentable {
|
|||
ts.beginEditing()
|
||||
applySyntaxHighlighting(to: ts, format: parent.fileFormat)
|
||||
ts.endEditing()
|
||||
(tv as? LineNumberTextView)?.applyEvalSpacing()
|
||||
tv.typingAttributes = [
|
||||
.font: Theme.editorFont,
|
||||
.foregroundColor: Theme.current.text
|
||||
|
|
@ -1451,6 +1454,7 @@ struct EditorTextView: NSViewRepresentable {
|
|||
applySyntaxHighlighting(to: ts, format: format)
|
||||
ts.endEditing()
|
||||
}
|
||||
(tv as? LineNumberTextView)?.applyEvalSpacing()
|
||||
tv.selectedRanges = sel
|
||||
tv.needsDisplay = true
|
||||
}
|
||||
|
|
@ -1636,6 +1640,7 @@ struct EditorTextView: NSViewRepresentable {
|
|||
ts.replaceCharacters(in: range, with: newMarkdown)
|
||||
applySyntaxHighlighting(to: ts, format: parent.fileFormat)
|
||||
ts.endEditing()
|
||||
(tv as? LineNumberTextView)?.applyEvalSpacing()
|
||||
tv.selectedRanges = sel
|
||||
parent.text = tv.string
|
||||
updateBlockRanges(for: tv)
|
||||
|
|
@ -3051,7 +3056,7 @@ class LineNumberTextView: NSTextView {
|
|||
|
||||
// MARK: - Eval Spacing
|
||||
|
||||
private func applyEvalSpacing() {
|
||||
func applyEvalSpacing() {
|
||||
guard let ts = textStorage else { return }
|
||||
let text = ts.string as NSString
|
||||
guard text.length > 0 else { return }
|
||||
|
|
|
|||
Loading…
Reference in New Issue