Skip to content

Support in-app value drag sources and drop targets - #10

Open
jeregrine wants to merge 2 commits into
elixir-crab:mainfrom
jeregrine:native-value-drags
Open

jeregrine wants to merge 2 commits into
elixir-crab:mainfrom
jeregrine:native-value-drags

Conversation

@jeregrine

@jeregrine jeregrine commented Oct 19, 2026 •

Copy link
Copy Markdown

Summary

Add UI.drag_source/1 and UI.drop_target(accepts: "values") for dragging application-owned string values between controls. The existing GPUI.Transfer events 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.

chrismccord and others added 2 commits October 19, 2026 08:36
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants