Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/GhosttyTerminalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
27 changes: 27 additions & 0 deletions cmuxTests/TerminalAndGhosttyTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
}
Comment thread
austinywang marked this conversation as resolved.

private func assertHitFallsInsideHostedTerminal(
_ hitView: NSView?,
hostedView: GhosttySurfaceScrollView,
Expand Down
Loading