Fix command palette focus after terminal find (#2089)
* test: cover command palette focus guard * fix: block terminal find from stealing palette focus * test: cover text view focus-stealer fallback * Add regression for hidden DevTools sync republish loop * Avoid redundant DevTools visibility publishes * test: cover browser find focus after workspace round-trip * fix: restore browser find focus after workspace round-trip * fix: keep browser find caret on workspace return * Add workspace round-trip split find regressions * Keep inactive find overlays from stealing focus --------- Co-authored-by: Lawrence Chen <lawrencecchen@users.noreply.github.com>
This commit is contained in:
parent
b42f64fbe3
commit
8a3ab6b3f0
10 changed files with 402 additions and 59 deletions
|
|
@ -7868,6 +7868,9 @@ final class GhosttySurfaceScrollView: NSView {
|
|||
tabId: terminalSurface.tabId,
|
||||
surfaceId: terminalSurface.id,
|
||||
searchState: searchState,
|
||||
canApplyFocusRequest: { [weak self] in
|
||||
self?.canApplyMountedSearchFieldFocusRequest() ?? false
|
||||
},
|
||||
onMoveFocusToTerminal: { [weak self] in
|
||||
self?.searchFocusTarget = .terminal
|
||||
self?.moveFocus()
|
||||
|
|
@ -7899,6 +7902,17 @@ final class GhosttySurfaceScrollView: NSView {
|
|||
return nil
|
||||
}
|
||||
|
||||
private func canApplyMountedSearchFieldFocusRequest() -> Bool {
|
||||
guard let terminalSurface = surfaceView.terminalSurface,
|
||||
let app = AppDelegate.shared,
|
||||
let manager = app.tabManagerFor(tabId: terminalSurface.tabId),
|
||||
manager.selectedTabId == terminalSurface.tabId,
|
||||
let workspace = manager.tabs.first(where: { $0.id == terminalSurface.tabId }) else {
|
||||
return false
|
||||
}
|
||||
return workspace.focusedPanelId == terminalSurface.id
|
||||
}
|
||||
|
||||
private func requestMountedSearchFieldFocus(
|
||||
generation: UInt64,
|
||||
force: Bool,
|
||||
|
|
@ -7906,6 +7920,7 @@ final class GhosttySurfaceScrollView: NSView {
|
|||
) {
|
||||
guard searchOverlayMutationGeneration == generation else { return }
|
||||
guard force || searchFocusTarget == .searchField else { return }
|
||||
guard canApplyMountedSearchFieldFocusRequest() else { return }
|
||||
guard let overlay = searchOverlayHostingView,
|
||||
overlay.superview === self,
|
||||
let window,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue