don't autohide scrollers
parent
d48f855a48
commit
49bf73458b
|
|
@ -32,7 +32,7 @@ class SurfaceScrollView: NSView {
|
||||||
scrollView = NSScrollView()
|
scrollView = NSScrollView()
|
||||||
scrollView.hasVerticalScroller = false
|
scrollView.hasVerticalScroller = false
|
||||||
scrollView.hasHorizontalScroller = false
|
scrollView.hasHorizontalScroller = false
|
||||||
scrollView.autohidesScrollers = true
|
scrollView.autohidesScrollers = false
|
||||||
scrollView.usesPredominantAxisScrolling = true
|
scrollView.usesPredominantAxisScrolling = true
|
||||||
// hide default background to show blur effect properly
|
// hide default background to show blur effect properly
|
||||||
scrollView.drawsBackground = false
|
scrollView.drawsBackground = false
|
||||||
|
|
@ -196,7 +196,7 @@ class SurfaceScrollView: NSView {
|
||||||
// Only update the pty if we have a valid (non-zero) content size. The content size
|
// Only update the pty if we have a valid (non-zero) content size. The content size
|
||||||
// can be zero when this is added early to a view, or to an invisible hierarchy.
|
// can be zero when this is added early to a view, or to an invisible hierarchy.
|
||||||
// Practically, this happened in the quick terminal.
|
// Practically, this happened in the quick terminal.
|
||||||
let width = surfaceContentWidth()
|
let width = scrollView.contentSize.width
|
||||||
let height = surfaceView.frame.height
|
let height = surfaceView.frame.height
|
||||||
if width > 0 && height > 0 {
|
if width > 0 && height > 0 {
|
||||||
surfaceView.sizeDidChange(CGSize(width: width, height: height))
|
surfaceView.sizeDidChange(CGSize(width: width, height: height))
|
||||||
|
|
@ -333,30 +333,6 @@ class SurfaceScrollView: NSView {
|
||||||
|
|
||||||
// MARK: Calculations
|
// MARK: Calculations
|
||||||
|
|
||||||
/// Calculate the content width reported to the core surface
|
|
||||||
///
|
|
||||||
/// If we have a legacy scrollbar and its not visible, then we account for that
|
|
||||||
/// in advance, because legacy scrollbars change our contentSize and force reflow
|
|
||||||
/// of our terminal which is not desirable.
|
|
||||||
/// See: https://github.com/ghostty-org/ghostty/discussions/9254
|
|
||||||
private func surfaceContentWidth() -> CGFloat {
|
|
||||||
let contentWidth = scrollView.contentSize.width
|
|
||||||
if scrollView.hasVerticalScroller {
|
|
||||||
let style =
|
|
||||||
scrollView.verticalScroller?.scrollerStyle
|
|
||||||
?? NSScroller.preferredScrollerStyle
|
|
||||||
// We only subtract the scrollbar width if it's hidden or not present,
|
|
||||||
// otherwise its width is already accounted for in contentSize.
|
|
||||||
if style == .legacy && (scrollView.verticalScroller?.isHidden ?? true) {
|
|
||||||
let scrollerWidth =
|
|
||||||
scrollView.verticalScroller?.frame.width
|
|
||||||
?? NSScroller.scrollerWidth(for: .regular, scrollerStyle: .legacy)
|
|
||||||
return max(0, contentWidth - scrollerWidth)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return contentWidth
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Calculate the appropriate document view height given a scrollbar state
|
/// Calculate the appropriate document view height given a scrollbar state
|
||||||
private func documentHeight() -> CGFloat {
|
private func documentHeight() -> CGFloat {
|
||||||
let contentHeight = scrollView.contentSize.height
|
let contentHeight = scrollView.contentSize.height
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue