From 02d6dc06728b9e0738937a1fa432fdb2cf84b6ea Mon Sep 17 00:00:00 2001 From: MrConnorKenway Date: Wed, 21 Jan 2026 20:35:51 +0800 Subject: [PATCH] feat(macos): focus surface view if search box is manually closed --- macos/Sources/Ghostty/Surface View/SurfaceView.swift | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView.swift b/macos/Sources/Ghostty/Surface View/SurfaceView.swift index a0e735715..c5c2ee97c 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView.swift @@ -190,7 +190,12 @@ extension Ghostty { SurfaceSearchOverlay( surfaceView: surfaceView, searchState: searchState, - onClose: { surfaceView.searchState = nil } + onClose: { +#if canImport(AppKit) + Ghostty.moveFocus(to: surfaceView) +#endif + surfaceView.searchState = nil + } ) } @@ -432,7 +437,6 @@ extension Ghostty { #if canImport(AppKit) .onExitCommand { if searchState.needle.isEmpty { - Ghostty.moveFocus(to: surfaceView) onClose() } else { Ghostty.moveFocus(to: surfaceView)