mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-03 20:12:42 +00:00
macos: start_search refocuses the search input
This commit is contained in:
@@ -1662,7 +1662,11 @@ extension Ghostty {
|
||||
|
||||
let startSearch = Ghostty.Action.StartSearch(c: v)
|
||||
DispatchQueue.main.async {
|
||||
surfaceView.searchState = Ghostty.SurfaceView.SearchState(from: startSearch)
|
||||
if surfaceView.searchState != nil {
|
||||
NotificationCenter.default.post(name: .ghosttySearchFocus, object: surfaceView)
|
||||
} else {
|
||||
surfaceView.searchState = Ghostty.SurfaceView.SearchState(from: startSearch)
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
|
||||
@@ -396,6 +396,9 @@ extension Notification.Name {
|
||||
/// Notification sent when scrollbar updates
|
||||
static let ghosttyDidUpdateScrollbar = Notification.Name("com.mitchellh.ghostty.didUpdateScrollbar")
|
||||
static let ScrollbarKey = ghosttyDidUpdateScrollbar.rawValue + ".scrollbar"
|
||||
|
||||
/// Focus the search field
|
||||
static let ghosttySearchFocus = Notification.Name("com.mitchellh.ghostty.searchFocus")
|
||||
}
|
||||
|
||||
// NOTE: I am moving all of these to Notification.Name extensions over time. This
|
||||
|
||||
@@ -441,6 +441,10 @@ extension Ghostty {
|
||||
}
|
||||
isSearchFieldFocused = true
|
||||
}
|
||||
.onReceive(NotificationCenter.default.publisher(for: .ghosttySearchFocus)) { notification in
|
||||
guard notification.object as? SurfaceView === surfaceView else { return }
|
||||
isSearchFieldFocused = true
|
||||
}
|
||||
.background(
|
||||
GeometryReader { barGeo in
|
||||
Color.clear.onAppear {
|
||||
|
||||
Reference in New Issue
Block a user