Merge pull request #2174 from manaflow-ai/task-pr-2089-followup-comments

Fix command palette follow-up review comments
This commit is contained in:
Lawrence Chen 2026-03-25 18:24:37 -07:00 committed by GitHub
commit 18531fd78e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 255 additions and 24 deletions

View file

@ -406,6 +406,7 @@ final class CommandPaletteOpenShortcutConsumptionTests: XCTestCase {
final class CommandPaletteFocusStealerClassificationTests: XCTestCase {
private final class NonViewTextDelegate: NSObject, NSTextViewDelegate {}
private final class UnrelatedViewTextDelegate: NSView, NSTextViewDelegate {}
func testTreatsGhosttySurfaceViewAsFocusStealer() {
let surfaceView = GhosttyNSView(frame: NSRect(x: 0, y: 0, width: 120, height: 80))
@ -446,6 +447,21 @@ final class CommandPaletteFocusStealerClassificationTests: XCTestCase {
"NSTextView responders should still be blocked via the NSView hierarchy walk when the delegate is not a view"
)
}
func testTreatsTextViewInsideTerminalHostedViewAsFocusStealerWhenDelegateViewIsUnrelated() {
let hostedView = GhosttySurfaceScrollView(
surfaceView: GhosttyNSView(frame: NSRect(x: 0, y: 0, width: 120, height: 80))
)
let textView = NSTextView(frame: NSRect(x: 0, y: 0, width: 120, height: 24))
let delegateView = UnrelatedViewTextDelegate(frame: .zero)
textView.delegate = delegateView
hostedView.addSubview(textView)
XCTAssertTrue(
isCommandPaletteFocusStealingTerminalOrBrowserResponder(textView),
"NSTextView responders should still be blocked via the NSView hierarchy walk when the delegate view is unrelated"
)
}
}