From c8f56ddaf8cd9b909de471f88d5721ee7a5ee83a Mon Sep 17 00:00:00 2001 From: Nishant Joshi Date: Sun, 18 Jan 2026 10:08:51 -0800 Subject: [PATCH] feat(macos): if the search box is empty directly close the box --- macos/Sources/Ghostty/Surface View/SurfaceView.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Ghostty/Surface View/SurfaceView.swift b/macos/Sources/Ghostty/Surface View/SurfaceView.swift index 524cb1298..a0e735715 100644 --- a/macos/Sources/Ghostty/Surface View/SurfaceView.swift +++ b/macos/Sources/Ghostty/Surface View/SurfaceView.swift @@ -431,7 +431,12 @@ extension Ghostty { } #if canImport(AppKit) .onExitCommand { - Ghostty.moveFocus(to: surfaceView) + if searchState.needle.isEmpty { + Ghostty.moveFocus(to: surfaceView) + onClose() + } else { + Ghostty.moveFocus(to: surfaceView) + } } #endif .backport.onKeyPress(.return) { modifiers in