Revert "macOS: close search bar if needed when it loses focus (#11980)" (#12046)

This reverts commit 20cfaae2e5, reversing
changes made to 3509ccf78e.

This breaks some behaviours when there are multiple splits, which
requires another click to focus to another split in the same window🫪
pull/12050/head
Mitchell Hashimoto 2026-04-01 14:32:09 -07:00 committed by GitHub
commit 92a4601f39
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 20 deletions

View File

@ -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)

View File

@ -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,