Skip to content

Commit 42f7138

Browse files
author
Ben Palmer
committed
Add logic for ensuring attribute updates when font or baselineoffset are changed in preferences.
1 parent 179f397 commit 42f7138

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Sources/CodeEditTextView/STTextViewController.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,12 @@ public class STTextViewController: NSViewController, STTextViewDelegate, ThemeAt
200200

201201
/// Reloads the UI to apply changes to ``STTextViewController/font``, ``STTextViewController/theme``, ...
202202
internal func reloadUI() {
203-
textView?.font = font
203+
// if font or baseline has been modified, set the hasSetStandardAttributesFlag
204+
// to false to ensure attributes are updated. This allows live UI updates when changing preferences.
205+
if textView?.font != font || rulerView.baselineOffset != baselineOffset {
206+
hasSetStandardAttributes = false
207+
}
208+
204209
textView?.textColor = theme.text
205210
textView?.backgroundColor = theme.background
206211
textView?.insertionPointColor = theme.insertionPoint

0 commit comments

Comments
 (0)