macOS: move search result counter inside text field
Move the search result counter (e.g. "1/30") inside the search text field using an overlay, preventing layout shift when results appear. This PR was authored with Claude Code.pull/9713/head
parent
71a2dad929
commit
f5b923573d
|
|
@ -409,11 +409,27 @@ extension Ghostty {
|
|||
TextField("Search", text: $searchState.needle)
|
||||
.textFieldStyle(.plain)
|
||||
.frame(width: 180)
|
||||
.padding(.horizontal, 8)
|
||||
.padding(.leading, 8)
|
||||
.padding(.trailing, 50)
|
||||
.padding(.vertical, 6)
|
||||
.background(Color.primary.opacity(0.1))
|
||||
.cornerRadius(6)
|
||||
.focused($isSearchFieldFocused)
|
||||
.overlay(alignment: .trailing) {
|
||||
if let selected = searchState.selected {
|
||||
Text("\(selected + 1)/\(searchState.total, default: "?")")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.monospacedDigit()
|
||||
.padding(.trailing, 8)
|
||||
} else if let total = searchState.total {
|
||||
Text("-/\(total)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.monospacedDigit()
|
||||
.padding(.trailing, 8)
|
||||
}
|
||||
}
|
||||
#if canImport(AppKit)
|
||||
.onExitCommand {
|
||||
Ghostty.moveFocus(to: surfaceView)
|
||||
|
|
@ -428,18 +444,6 @@ extension Ghostty {
|
|||
return .handled
|
||||
}
|
||||
|
||||
if let selected = searchState.selected {
|
||||
Text("\(selected + 1)/\(searchState.total, default: "?")")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.monospacedDigit()
|
||||
} else if let total = searchState.total {
|
||||
Text("-/\(total)")
|
||||
.font(.caption)
|
||||
.foregroundColor(.secondary)
|
||||
.monospacedDigit()
|
||||
}
|
||||
|
||||
Button(action: {
|
||||
guard let surface = surfaceView.surface else { return }
|
||||
let action = "navigate_search:next"
|
||||
|
|
|
|||
Loading…
Reference in New Issue