aboutsummaryrefslogtreecommitdiff
path: root/Map/Presentation/Base Components/MapTextEditor.swift
diff options
context:
space:
mode:
authorRuben Beltran del Rio <git@r.bdr.sh>2025-07-09 08:54:22 +0200
committerRuben Beltran del Rio <git@r.bdr.sh>2025-07-09 08:54:22 +0200
commit005c2048af141e3658a170c283dd41bd4fb5cdcb (patch)
tree9a07100197681a38a78e663c66d034bfacf6ec71 /Map/Presentation/Base Components/MapTextEditor.swift
parent1e89ea22d551cebfd6c0c0451000c3283ddb2d2e (diff)
Make soft-wrap configurable.
Diffstat (limited to 'Map/Presentation/Base Components/MapTextEditor.swift')
-rw-r--r--Map/Presentation/Base Components/MapTextEditor.swift16
1 files changed, 12 insertions, 4 deletions
diff --git a/Map/Presentation/Base Components/MapTextEditor.swift b/Map/Presentation/Base Components/MapTextEditor.swift
index c4ac561..4295918 100644
--- a/Map/Presentation/Base Components/MapTextEditor.swift
+++ b/Map/Presentation/Base Components/MapTextEditor.swift
@@ -82,12 +82,20 @@ class MapTextEditorController: NSViewController {
textView.font = NSFont.Theme.Editor.regular
textView.textContainerInset = NSSize(width: 0, height: Dimensions.Spacing.coziest)
- // Disable word wrapping to prevent flashing on soft-wrapped lines
- textView.textContainer?.widthTracksTextView = false
- textView.textContainer?.containerSize = NSSize(
- width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
+ // Configure text wrapping based on user preference
+ let softWrapLines = UserDefaults.standard.bool(forKey: "softWrapLines")
+ if !softWrapLines {
+ // Disable word wrapping to prevent flashing on soft-wrapped lines
+ textView.textContainer?.widthTracksTextView = false
+ textView.textContainer?.containerSize = NSSize(
+ width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
+ } else {
+ textView.textContainer?.widthTracksTextView = true
+ }
+
textView.isHorizontallyResizable = true
textView.isVerticallyResizable = true
+
self.view = scrollView
}