macOS: Don't clip surfaceView to contentView

Fixes #9248
pull/9517/head
Daniel Wennberg 2025-11-08 08:29:59 -08:00
parent 9894722051
commit 3142c5aa60
1 changed files with 10 additions and 9 deletions

View File

@ -36,6 +36,9 @@ class SurfaceScrollView: NSView {
scrollView.usesPredominantAxisScrolling = true
// hide default background to show blur effect properly
scrollView.drawsBackground = false
// don't let the content view clip it's subviews, to enable the
// surface to draw the background behind non-overlay scrollers
scrollView.contentView.clipsToBounds = false
// The document view is what the scrollview is actually going
// to be directly scrolling. We set it up to a "blank" NSView
@ -142,6 +145,11 @@ class SurfaceScrollView: NSView {
// Fill entire bounds with scroll view
scrollView.frame = bounds
surfaceView.frame.size = scrollView.bounds.size
// We only set the width of the documentView here, as the height depends
// on the scrollbar state and is updated in synchronizeScrollView
documentView.frame.size.width = scrollView.bounds.width
// When our scrollview changes make sure our scroller and surface views are synchronized
synchronizeScrollView()
@ -175,21 +183,14 @@ class SurfaceScrollView: NSView {
/// so the renderer only needs to render what's currently on screen.
private func synchronizeSurfaceView() {
let visibleRect = scrollView.contentView.documentVisibleRect
surfaceView.frame = visibleRect
surfaceView.frame.origin = visibleRect.origin
}
/// Sizes the document view and scrolls the content view according to the scrollbar state
private func synchronizeScrollView() {
// We adjust the document height first, as the content width may depend on it.
// Update the document height to give our scroller the correct proportions
documentView.frame.size.height = documentHeight()
// Our width should be the content width to account for visible scrollers.
// We don't do horizontal scrolling in terminals. The surfaceView width is
// yoked to the document width (this is distinct from the content width
// passed to surfaceView.sizeDidChange, which is only updated on layout).
documentView.frame.size.width = scrollView.contentSize.width
surfaceView.frame.size.width = scrollView.contentSize.width
// Only update our actual scroll position if we're not actively scrolling.
if !isLiveScrolling {
// Convert row units to pixels using cell height, ignore zero height.