macos: search overlay shows search progress
parent
7835ad0ea4
commit
d4a2f3db71
|
|
@ -426,6 +426,14 @@ extension Ghostty {
|
||||||
return .handled
|
return .handled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let selected = searchState?.selected {
|
||||||
|
let totalText = searchState?.total.map { String($0) } ?? "?"
|
||||||
|
Text("\(selected)/\(totalText)")
|
||||||
|
.font(.caption)
|
||||||
|
.foregroundColor(.secondary)
|
||||||
|
.monospacedDigit()
|
||||||
|
}
|
||||||
|
|
||||||
Button(action: {
|
Button(action: {
|
||||||
guard let surface = surfaceView.surface else { return }
|
guard let surface = surfaceView.surface else { return }
|
||||||
let action = "navigate_search:next"
|
let action = "navigate_search:next"
|
||||||
|
|
@ -814,6 +822,8 @@ extension FocusedValues {
|
||||||
extension Ghostty.SurfaceView {
|
extension Ghostty.SurfaceView {
|
||||||
class SearchState: ObservableObject {
|
class SearchState: ObservableObject {
|
||||||
@Published var needle: String = ""
|
@Published var needle: String = ""
|
||||||
|
@Published var selected: UInt? = nil
|
||||||
|
@Published var total: UInt? = nil
|
||||||
|
|
||||||
init(from startSearch: Ghostty.Action.StartSearch) {
|
init(from startSearch: Ghostty.Action.StartSearch) {
|
||||||
self.needle = startSearch.needle ?? ""
|
self.needle = startSearch.needle ?? ""
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue