Skip to content

Lists: TreeDrag is public, so a drop past the tree's rows names the dragged node - #9

Merged
Raiden-MeixElysia merged 1 commit into
ELY-Open-Source:elyterminal-0.1.1from
2youg1:tree-drag-public
Nov 2, 2026
Merged

Raiden-MeixElysia merged 1 commit into
ELY-Open-Source:elyterminal-0.1.1from
2youg1:tree-drag-public

Conversation

@2youg1

@2youg1 2youg1 commented Nov 1, 2026

Copy link
Copy Markdown

What and why

ELYTerminal wants its Files panel's tree rows to be draggable onto its terminal: dropping a node there types the file's path at the shell. gpui dispatches an in-app drop to the listeners whose type matches the drag value's type exactly, and Tree's drag value TreeDrag is pub(crate), so an embedder's drop target can never receive it.

This makes TreeDrag public, with key() and label() accessors, exported from lists. The row still drags exactly as before; a drop back inside the tree stays the tree's own move, since owner remains private and the internal handlers keep matching on it.

A consumer looks like:

terminal_root.on_drop(cx.listener(|view, drag: &TreeDrag, _, cx| {
    view.dropped(drag.key().clone(), cx)
}));

Notes

  • Ely's main has since split into crates; the same change wants porting there (the type lives in the tree crate), which I can do in a follow-up if this shape is right.
  • Consumer PR, pinned to this branch meanwhile: ELY-Open-Source/ELYTerminal (drag a Files node onto the terminal to type its path).

How it was tested

  • cargo fmt -- --check passes.
  • The change is visibility plus two accessors; Ely's own CI builds and tests the tree.

…ragged node

ELYTerminal's Files drags a node onto its terminal, whose drop listener
matches gpui's drag value by type, so the type must be public. The owner
stays private: a drop back inside the tree stays the tree's own move.
@Raiden-MeixElysia
Raiden-MeixElysia merged commit 23605d2 into ELY-Open-Source:elyterminal-0.1.1 Nov 2, 2026
@2youg1
2youg1 deleted the tree-drag-public branch November 2, 2026 19:10
Raiden-MeixElysia added a commit to ELY-Open-Source/ELYTerminal that referenced this pull request Nov 2, 2026
A file or folder dragged from the Files panel and dropped on the
terminal types its absolute path at the cursor, kept literal for the
session's shell and followed by a space, as a dropped OS file does.

Ely's Tree rows already drag a TreeDrag value, now public in
ELY-Open-Source/Ely-GPUI-Components#9; the terminal takes a second
on_drop for it, gpui matching each drop by its type, and the workspace
resolves the node's key through Files and types the path with the
drop's quoting. The Ely dep is pinned by rev to the PR's branch until
it merges.
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