Fix terminal portal tab drop routing

Merged
LA
6mo ago
+1204-430

Summary

  • Route Bonsplit tab drops over portal-hosted terminal panes through pane-local drop targets.
  • Keep Bonsplit tab-strip drag and reorder events passing through terminal/browser portal overlays.
  • Keep the Bonsplit tab drag E2E using XCTest native drag gestures on CI.

Tests

  • Local: xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/cmux-dropfix-unit -only-testing:cmuxTests/WindowTerminalHostViewTests/testHostViewPassesThroughUnderlyingTabStripDuringMouseDrag -only-testing:cmuxTests/WindowTerminalHostViewTests/testTabStripPassThroughTreatsAppKitDragRoutingAsPointerEvents -only-testing:cmuxTests/WindowTerminalHostViewTests/testTerminalPaneDropTargetDefersToUnderlyingTabStrip test
  • Local: xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux -configuration Debug -destination "platform=macOS" -derivedDataPath /tmp/cmux-dropfix-ui-build -only-testing:cmuxUITests/BonsplitTabDragUITests/testMinimalModeKeepsTabReorderWorking build-for-testing
  • CI: https://github.com/manaflow-ai/cmux/actions/runs/25104895502
  • CI artifact issue: https://github.com/manaflow-ai/cmux-dev-artifacts/issues/1126

Dogfood

  • Tagged build: dropfix5

Summary by cubic

Fixes Bonsplit tab drop routing over portal-hosted terminal panes by adding a pane-local drop target and unifying minimal tab-strip pass-through across terminal and browser portals. Switches the Bonsplit tab drag E2E to XCTest native drag for CI stability.

  • Bug Fixes

    • Added TerminalPaneDropTargetView to capture internal tab drags, render zones, and delegate moves/splits via Workspace.performPortalPaneDrop.
    • Terminal and browser portals (and drop targets) defer to the minimal tab strip; AppKit drag‑routing events count as pointer input; terminal host returns the drop overlay when hit.
    • External drags (.fileURL/.URL/.png/.tiff/.html) bypass portal overlays; WKWebView keeps these types registered and receives the full drag lifecycle.
    • Normalized edge‑adjacent drops and same‑pane center no‑ops; E2E uses XCTest drag gestures instead of raw CGEvents.
  • Refactors

    • Extracted pass‑through helpers to BonsplitTabBarPassThrough; moved terminal helpers to GhosttyTerminalViewSupport; split portal debug utils to TerminalWindowPortalDebug.
    • Centralized pane‑drop logic in WorkspacePortalPaneDrop and exposed Workspace.handleExternalTabDrop; GhosttyTerminalView now hosts the drop‑target overlay and wires its context.
    • Split drag‑routing tests into PortalTabDragRoutingTests, BrowserPaneDropRoutingTests, and CmuxWebViewDragRoutingTests.

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved pointer event routing and drag-and-drop handling between terminal panes and browser windows.
    • Enhanced tab bar interaction detection to more accurately identify when drag operations should target the tab bar.
  • Refactor

    • Reorganized pass-through decision logic for improved maintainability and consistency.
  • Tests

    • Added comprehensive test coverage for drag-and-drop routing behavior and event sequencing.
    • Expanded external pasteboard handling tests for browser drag operations.