FIx failing showing scrollbar when unwrapped (fix #1037)

This commit is contained in:
1024jp 2020-03-02 16:26:50 +09:00
parent 96c0187477
commit c662f5bfe9
2 changed files with 13 additions and 8 deletions

View File

@ -11,6 +11,11 @@ Change Log
- Update “Kotlin” syntax style.
### Fixes
- Fix an issue where the horizontal scrollbar didn't appear by unwrapping lines if the document consists of a single very long line.
3.8.11 (398)
--------------------------

View File

@ -199,6 +199,14 @@ extension NSTextView {
let visibleRange = self.visibleRange
let isVertical = (self.layoutOrientation == .vertical)
if isVertical {
self.enclosingScrollView?.hasVerticalScroller = !newValue
self.isVerticallyResizable = !newValue
} else {
self.enclosingScrollView?.hasHorizontalScroller = !newValue
self.isHorizontallyResizable = !newValue
}
if newValue {
let width = self.visibleRect.width
self.frame.size[keyPath: isVertical ? \NSSize.height : \NSSize.width] = width * self.scale
@ -209,14 +217,6 @@ extension NSTextView {
textContainer.size = self.infiniteSize
}
if isVertical {
self.isVerticallyResizable = !newValue
self.enclosingScrollView?.hasVerticalScroller = !newValue
} else {
self.isHorizontallyResizable = !newValue
self.enclosingScrollView?.hasHorizontalScroller = !newValue
}
if let visibleRange = visibleRange, var visibleRect = self.boundingRect(for: visibleRange) {
visibleRect.size.width = 0
visibleRect = visibleRect.inset(by: -self.textContainerOrigin)