Repository navigation
Fix terminal file drops inserting paths - #3900
austinywang wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughA guard in GhosttySurfaceScrollView.paneDropTargetForDrop(at:) now returns nil when the pane drop target view's dropContext is nil, preventing hit-testing and selection; a regression test verifies the lookup returns nil after clearing the drop context. ChangesDrop-target detection guard
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly Related PRs
Poem
🚥 Pre-merge checks | ✅ 14 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (14 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
a3c1507 to
be31f19
Compare
Greptile SummaryThis PR fixes a drag-and-drop routing bug where
Confidence Score: 5/5Safe to merge — the guard is a minimal, correctly ordered early exit with no side effects on any path other than the broken nil-context one. The production change is a single guard line that short-circuits an existing function only when dropContext is already nil; it cannot affect pane drop routing when a real context is present. The regression test now covers both the active-context and cleared-context paths, making the fix observable and falsifiable. No concurrency, state, or architectural concerns are introduced. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Finder file drop"] --> B["paneDropTargetForDrop(at:)"]
B --> C{"dropContext != nil"}
C -- "false — NEW GUARD" --> D["Return nil → terminal text insertion"]
C -- "true" --> E{"bounds check"}
E -- "fail" --> D
E -- "pass" --> F{"converted point check"}
F -- "fail" --> D
F -- "pass" --> G{"shouldDeferToPaneTabBar"}
G -- "true" --> D
G -- "false" --> H["Return TerminalPaneDropTargetView → pane routing"]
Reviews (2): Last reviewed commit: "Let terminal file drops reach path inser..." | Re-trigger Greptile |
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.
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.
be31f19 to
6d13e2b
Compare
Summary
Local repro
main, construct aGhosttySurfaceScrollViewand install an activeTerminalPaneDropContext.paneDropTargetForDrop(at:)at the center of the hosted terminal; active pane routing is available.setPaneDropContext(nil), mirroring a stale/inactive terminal portal lookup during a Finder file drop.TerminalPaneDropTargetView, even though that target cannot handle the drop because its context is nil. This can route the file drop toward the built-in preview path instead of terminal text insertion.Commits
47b730493adds the failing regression test only.6d13e2b09applies the fix.Testing
xcodebuild/local test execution is intentionally avoided before CI.$iterate-pruntil fully green.Closes #3729
Note
Low Risk
Low risk: a small guard condition changes drop-target discovery only when
dropContextis nil, plus a focused regression test to lock the behavior in.Overview
Fixes Finder file drops being misrouted by making
paneDropTargetForDrop(at:)returnnilunlesspaneDropTargetView.dropContextis set, so inactive pane-drop targets no longer shadow file-path insertion.Adds a regression test ensuring drop-target lookup succeeds with an active context and returns
nilaftersetPaneDropContext(nil).Reviewed by Cursor Bugbot for commit 6d13e2b. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
Bug Fixes
Tests