From 13f7d23145891fbe3a99c268e7df388a3c9e52fc Mon Sep 17 00:00:00 2001 From: fru1tworld Date: Mon, 6 Apr 2026 19:22:47 +0900 Subject: [PATCH] macOS: force layout sync when frame size mismatches GeometryReader --- macos/Sources/Ghostty/Surface View/SurfaceView.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView.swift b/macos/Sources/Ghostty/Surface View/SurfaceView.swift index 6323e6af6..a6ddf4219 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView.swift @@ -621,8 +621,13 @@ extension Ghostty { } func updateOSView(_ scrollView: SurfaceScrollView, context: Context) { - // Nothing to do: SwiftUI automatically updates the frame size, and - // SurfaceScrollView handles the rest in response to that + // SwiftUI may defer frame updates under system load (e.g., memory + // pressure, heavy I/O) or when external window managers trigger rapid + // layout changes. When that happens, the scroll view's bounds can + // fall out of sync with the size reported by GeometryReader, causing + // the surface to render at stale dimensions. + guard scrollView.bounds.size != size else { return } + scrollView.needsLayout = true } #else func makeOSView(context: Context) -> SurfaceView {