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