From 3142c5aa606056a0af0d73a2579c910c84476450 Mon Sep 17 00:00:00 2001 From: Daniel Wennberg Date: Sat, 8 Nov 2025 08:29:59 -0800 Subject: [PATCH] macOS: Don't clip surfaceView to contentView Fixes #9248 --- macos/Sources/Ghostty/SurfaceScrollView.swift | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/macos/Sources/Ghostty/SurfaceScrollView.swift b/macos/Sources/Ghostty/SurfaceScrollView.swift index e455a32c8..70e22b648 100644 --- a/macos/Sources/Ghostty/SurfaceScrollView.swift +++ b/macos/Sources/Ghostty/SurfaceScrollView.swift @@ -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,20 +183,13 @@ 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 {