diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView.swift b/macos/Sources/Ghostty/Surface View/SurfaceView.swift index 8036f944d..47503dc0e 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView.swift @@ -437,10 +437,11 @@ extension Ghostty { } } #if canImport(AppKit) - .onExitCommand(perform: onResignFirstResponder) - .onChange(of: isSearchFieldFocused) { newValue in - if !newValue { - onResignFirstResponder() + .onExitCommand { + if searchState.needle.isEmpty { + onClose() + } else { + Ghostty.moveFocus(to: surfaceView) } } #endif @@ -519,15 +520,7 @@ extension Ghostty { ) } } -#if canImport(AppKit) - private func onResignFirstResponder() { - if searchState.needle.isEmpty { - onClose() - } else { - Ghostty.moveFocus(to: surfaceView) - } - } -#endif + private var clipShape: some Shape { if #available(iOS 26.0, macOS 26.0, *) { return ConcentricRectangle(corners: .concentric(minimum: 8), isUniform: true) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift index dc39f1051..8f4fb01cf 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView_AppKit.swift @@ -660,13 +660,6 @@ extension Ghostty { return event } - guard searchState == nil else { - // We don't want to process events that - // are supposed to be handled by SearchOverlay - // When clicking outside, SurfaceView will become first responder automatically - return event - } - // We only want to process events that are on this window. guard let window, event.window != nil,