From e56dce3d84e62ee40e40426ab91c9c871bbb303b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 29 Dec 2025 06:12:41 -0800 Subject: [PATCH] macos: don't create drop zone at all if self dragging --- .../Splits/TerminalSplitTreeView.swift | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/macos/Sources/Features/Splits/TerminalSplitTreeView.swift b/macos/Sources/Features/Splits/TerminalSplitTreeView.swift index 73d61439c..2a42dc599 100644 --- a/macos/Sources/Features/Splits/TerminalSplitTreeView.swift +++ b/macos/Sources/Features/Splits/TerminalSplitTreeView.swift @@ -99,12 +99,20 @@ fileprivate struct TerminalSplitLeaf: View { Ghostty.InspectableSurface( surfaceView: surfaceView, isSplit: isSplit) - .onDrop(of: [.ghosttySurfaceId], delegate: SplitDropDelegate( - dropState: $dropState, - viewSize: geometry.size, - destinationSurface: surfaceView, - action: action - )) + .background { + // If we're dragging ourself, we hide the entire drop zone. This makes + // it so that a released drop animates back to its source properly + // so it is a proper invalid drop zone. + if !isSelfDragging { + Color.clear + .onDrop(of: [.ghosttySurfaceId], delegate: SplitDropDelegate( + dropState: $dropState, + viewSize: geometry.size, + destinationSurface: surfaceView, + action: action + )) + } + } .overlay { if !isSelfDragging, case .dropping(let zone) = dropState { zone.overlay(in: geometry) @@ -113,6 +121,9 @@ fileprivate struct TerminalSplitLeaf: View { } .onPreferenceChange(Ghostty.DraggingSurfaceKey.self) { value in isSelfDragging = value == surfaceView.id + if isSelfDragging { + dropState = .idle + } } .accessibilityElement(children: .contain) .accessibilityLabel("Terminal pane")