macOS: Fix editor scrolling

This commit is contained in:
Roopesh Chander 2019-01-11 16:47:20 +05:30
parent 1c3cf52c7d
commit bec0cb1e75
1 changed files with 3 additions and 2 deletions

View File

@ -28,8 +28,9 @@ class TunnelEditViewController: NSViewController {
let minHeight: CGFloat = 310 let minHeight: CGFloat = 310
textView.minSize = NSSize(width: 0, height: minHeight) textView.minSize = NSSize(width: 0, height: minHeight)
textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude) textView.maxSize = NSSize(width: CGFloat.greatestFiniteMagnitude, height: CGFloat.greatestFiniteMagnitude)
textView.autoresizingMask = [.width, .height] textView.autoresizingMask = [.width] // Width should be based on superview width
textView.isHorizontallyResizable = true textView.isHorizontallyResizable = false // Width shouldn't be based on content
textView.isVerticallyResizable = true // Height should be based on content
if let textContainer = textView.textContainer { if let textContainer = textView.textContainer {
textContainer.size = NSSize(width: minWidth, height: CGFloat.greatestFiniteMagnitude) textContainer.size = NSSize(width: minWidth, height: CGFloat.greatestFiniteMagnitude)
textContainer.widthTracksTextView = true textContainer.widthTracksTextView = true