macOS: handle surface focus more gracefully

This will fix surface focus state is not consistent with first responder state when the search bar is open
This commit is contained in:
Lukas
2026-03-28 22:46:00 +01:00
parent 5540f5f249
commit 32920b6b2a
2 changed files with 7 additions and 3 deletions

View File

@@ -301,9 +301,8 @@ class BaseTerminalController: NSWindowController,
// Our focus state requires that this window is key and our currently
// focused surface is the surface in this view.
let focused: Bool = (window?.isKeyWindow ?? false) &&
!commandPaletteIsShowing &&
focusedSurface != nil &&
surfaceView == focusedSurface!
surfaceView == focusedSurface &&
surfaceView.isFirstResponder
surfaceView.focusDidChange(focused)
}
}

View File

@@ -14,6 +14,11 @@ extension NSView {
return false
}
/// Returns true if this view is currently the first responder
var isFirstResponder: Bool {
window?.firstResponder === self
}
}
// MARK: Screenshot