Skip to content
Merged
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
8 changes: 5 additions & 3 deletions Sources/Sidebar/SidebarBonsplitTabWorkspaceDropView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ final class SidebarBonsplitTabWorkspaceDropView: NSView {
/// destination by registered type and geometry, not `hitTest`, and a
/// workspace row drag also carries the Bonsplit pane-merge capability, so
/// this view receives row reorders and hands them to that destination.
weak var reorderDestination: NSView?
weak var reorderDestination: SidebarWorkspaceReorderDropView?
var canPerformAction: (SidebarDropPlanner.WorkspaceDropAction, BonsplitTabDragPayload.Transfer) -> Bool = { _, _ in false }
var updateAutoscroll: () -> Void = {}
var setWorkspaceDropTargetCollectionActive: (Bool) -> Void = { _ in }
Expand All @@ -36,7 +36,9 @@ final class SidebarBonsplitTabWorkspaceDropView: NSView {
override var acceptsFirstResponder: Bool { false }

override func draggingEnded(_ sender: any NSDraggingInfo) {
if let reorder = reorderDestination(for: sender) { return reorder.draggingEnded(sender) }
// The reorder view does not implement `draggingEnded:`; forwarding it
// would raise an unrecognized selector.
if reorderDestination(for: sender) != nil { return }
ownershipFeedback.clear()
}

Expand Down Expand Up @@ -361,7 +363,7 @@ final class SidebarBonsplitTabWorkspaceDropView: NSView {
}

/// The reorder destination when the drag is a sidebar workspace row.
private func reorderDestination(for sender: (any NSDraggingInfo)?) -> NSView? {
private func reorderDestination(for sender: (any NSDraggingInfo)?) -> SidebarWorkspaceReorderDropView? {
guard let reorderDestination else { return nil }
let types = (sender?.draggingPasteboard ?? NSPasteboard(name: .drag)).types
return DragOverlayRoutingPolicy.hasSidebarTabReorder(types) ? reorderDestination : nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ import Testing
#expect(bonsplit.prepareForDragOperation(sender))
#expect(bonsplit.performDragOperation(sender))
bonsplit.concludeDragOperation(sender)
// AppKit sends this to the overlay, which responds to it; the reorder
// view beneath does not, so it must not be forwarded there.
bonsplit.draggingEnded(sender)

#expect(updatedPoints.count == 2)
#expect(droppedPoints.count == 1)
Expand Down
Loading