From 081d73d850f1cf679207a2a2e1efa5b96133421e Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Tue, 25 Nov 2025 12:26:52 -0800 Subject: [PATCH] macos: changes to SearchState trigger calls to internals --- macos/Sources/Ghostty/SurfaceView_AppKit.swift | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/macos/Sources/Ghostty/SurfaceView_AppKit.swift b/macos/Sources/Ghostty/SurfaceView_AppKit.swift index 19054b6c3..50b0e8597 100644 --- a/macos/Sources/Ghostty/SurfaceView_AppKit.swift +++ b/macos/Sources/Ghostty/SurfaceView_AppKit.swift @@ -65,7 +65,17 @@ extension Ghostty { @Published var keySequence: [KeyboardShortcut] = [] // The current search state. When non-nil, the search overlay should be shown. - @Published var searchState: SearchState? = nil + @Published var searchState: SearchState? = nil { + didSet { + // If the search state becomes nil, we need to make sure we're stopping + // the search internally. + if searchState == nil { + guard let surface = self.surface else { return } + let action = "search:" + ghostty_surface_binding_action(surface, action, UInt(action.count)) + } + } + } // The time this surface last became focused. This is a ContinuousClock.Instant // on supported platforms.