From 47b730493747c55293c23219fc20e6980f901845 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Mon, 11 May 2026 19:53:30 -0700 Subject: [PATCH 1/2] Expose inactive terminal drop targets shadowing file paths A terminal portal can currently advertise a pane drop target after its drop context has been cleared. That lets the overlay route a Finder file drop into the pane-drop/viewer path instead of allowing the terminal text insertion path to own the file path. Constraint: The bugfix commit must be separate, so this commit intentionally adds only the failing regression test. Confidence: high Scope-risk: narrow Tested: Not run locally; user explicitly forbade direct xcodebuild and CI will exercise this regression before the fix commit. Not-tested: Local XCTest execution. --- cmuxTests/TerminalAndGhosttyTests.swift | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/cmuxTests/TerminalAndGhosttyTests.swift b/cmuxTests/TerminalAndGhosttyTests.swift index ac6ef346ca8e..0d94064ed894 100644 --- a/cmuxTests/TerminalAndGhosttyTests.swift +++ b/cmuxTests/TerminalAndGhosttyTests.swift @@ -2195,6 +2195,33 @@ final class WindowTerminalHostViewTests: XCTestCase { return hostedView } + func testTerminalPaneDropTargetLookupRequiresActiveDropContext() { + let frame = NSRect(x: 0, y: 0, width: 240, height: 160) + let hostedView = makeHostedTerminalView(frame: frame) + hostedView.layoutSubtreeIfNeeded() + hostedView.layout() + let dropPoint = NSPoint(x: frame.midX, y: frame.midY) + + hostedView.setPaneDropContext(TerminalPaneDropContext( + workspaceId: UUID(), + panelId: UUID(), + paneId: PaneID(id: UUID()) + )) + XCTAssertNotNil( + hostedView.paneDropTargetForDrop(at: dropPoint), + "Active terminal pane drop targets should remain discoverable for pane drop routing" + ) + + hostedView.setPaneDropContext(nil) + + let target = hostedView.paneDropTargetForDrop(at: dropPoint) + + XCTAssertNil( + target, + "Inactive terminal pane drop targets must not shadow terminal file-path drop insertion" + ) + } + private func assertHitFallsInsideHostedTerminal( _ hitView: NSView?, hostedView: GhosttySurfaceScrollView, From 6d13e2b09db309ce8a42f79b83917cfda98b73b7 Mon Sep 17 00:00:00 2001 From: austinpower1258 Date: Mon, 11 May 2026 19:54:11 -0700 Subject: [PATCH 2/2] Let terminal file drops reach path insertion Terminal portal lookup now applies the same active-context invariant as pane hit testing and browser portal lookup. When a terminal pane has no drop context, it is no longer advertised as a pane drop target, so Finder file drops can continue to the terminal text insertion path instead of being intercepted by preview routing. Constraint: User required the fix in a separate commit after the failing regression test commit. Rejected: Falling back after a pane target rejects the drop | broader overlay behavior change that could hide legitimate pane-drop failures. Confidence: high Scope-risk: narrow Directive: Keep terminal and browser pane drop lookup aligned; a pane target without context must not be discoverable through portal lookup. Tested: Not run locally; user explicitly forbade direct xcodebuild before CI. Regression is covered by testTerminalPaneDropTargetLookupRequiresActiveDropContext. Not-tested: Local XCTest execution and manual drag/drop before CI. --- Sources/GhosttyTerminalView.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/Sources/GhosttyTerminalView.swift b/Sources/GhosttyTerminalView.swift index 259e40192c3a..0b851274c59e 100644 --- a/Sources/GhosttyTerminalView.swift +++ b/Sources/GhosttyTerminalView.swift @@ -11207,6 +11207,7 @@ final class GhosttySurfaceScrollView: NSView { } func paneDropTargetForDrop(at localPoint: NSPoint) -> TerminalPaneDropTargetView? { + guard paneDropTargetView.dropContext != nil else { return nil } guard bounds.contains(localPoint) else { return nil } let pointInTarget = paneDropTargetView.convert(localPoint, from: self) guard paneDropTargetView.bounds.contains(pointInTarget) else { return nil }