From 005c2048af141e3658a170c283dd41bd4fb5cdcb Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Wed, 9 Jul 2025 08:54:22 +0200 Subject: Make soft-wrap configurable. --- Map/Presentation/Base Components/MapTextEditor.swift | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Map/Presentation/Base Components/MapTextEditor.swift') 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 } -- cgit