Repository navigation
Conversation
UI.drag_source wraps its children in an in-app drag carrying a string value. A press that doesn't move still clicks the children, so a control can offer both. Nothing follows the pointer: the application draws its own feedback from the target's move events. UI.drop_target takes accepts: "values" to receive those drags instead of operating-system files (the default, unchanged). The value arrives as the transfer payload's text on enter and drop; positions stay in window coordinates, so a target inside a scroll can be mapped through its content's bounds events. A value drag ends with the mouse button wherever it is released. Once the release has been dispatched, a target whose drop didn't fire reports a leave, so a drag released elsewhere never leaves a session open.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
UI.drag_source/1andUI.drop_target(accepts: "values")for dragging application-owned string values between controls. The existingGPUI.Transferevents carry the value as payload text, with window-native-pixel coordinates; the app draws feedback and decides what a drop means.File drops remain the default and ignore in-app value drags. Dropping consumes the target session; releasing elsewhere emits leave rather than retaining a stale drag. Public values reuse the transfer payload's UTF-8/1 MiB validation.
This extracts Chris McCord's implementation and is based directly on upstream main, independently of terminal PR #9.
Evidence
Native mouse-driven tests assert enter → move → drop with unchanged payload text, release-outside-target → leave, and rejection of value drags by file-only targets. Existing file-transfer lifecycle coverage remains in place. Public-helper tests cover both modes and reject oversized/invalid UTF-8 values.
Compatibility and validation limits
Additive component/schema API; existing file-drop callers need no changes. No files are read, uploaded, or assigned product meaning by GPUI, and no dependency or package-version changes are included. This needs a matching native host release.
The locked repository quality gate passes. Clean package-source validation encountered the same pre-existing gpui-component/Zed inspector and wrap_line API errors already documented in #9; the invocation then timed out. The unchanged upstream baseline reproduces those dependency errors. OS-level cross-window/desktop drag delivery was not tested.