Skip to content

Drop files as @-references; move internal DnD to pointer events#57

Merged
Ed-Barnes937 merged 1 commit into
mainfrom
file-drop
Jul 17, 2026
Merged

Drop files as @-references; move internal DnD to pointer events#57
Ed-Barnes937 merged 1 commit into
mainfrom
file-drop

Conversation

@Ed-Barnes937

Copy link
Copy Markdown
Collaborator

What

Dropping OS files onto the window now inserts each as an @<path> reference into the active session's prompt — reusing the file explorer's PTY-write path.

Getting file paths on drop requires Tauri's OS drag-drop handler (dragDropEnabled: true), but that handler swallows the webview's HTML5 drag events. So the four internal drag flows are rebuilt on pointer events.

Changes

  • tauri.conf.jsondragDropEnabled: true.
  • main.ts
    • onDragDropEvent handler: writes @<path> per dropped file to the active session's PTY, then focuses the terminal.
    • A shared draggable(handle, begin) primitive: threshold-gated pointer drag with pointer capture, Esc/cancel handling, and click suppression. Commits on release over a target; Esc/pointercancel leaves state untouched (mirrors the old drop-vs-dragend split).
    • Converted all four flows and removed the now-dead dragging* module vars and the makeSectionDropTarget / makeCardDropTarget wiring (targets are now annotated with data attributes and hit-tested from the source).
  • Tests — iwft drag helpers drive real pointer events (page.mouse) instead of synthetic DragEvents; added pointerDragElement to the base page object.

Flows converted

Flow
Tab reorder + tab→terminal split-drop
Sidebar row → section header
Board card → section column
Board column reorder

Verification

  • npm run typecheck passes
  • Unit: 49 passed
  • iwft (real-browser pointer events): 95 passed
  • File drop confirmed working manually on macOS / Tauri 2.11

Notes

  • No OS drag-ghost image anymore (native dnd rendered one). Feedback is the dimmed source + existing insertion markers / column highlights.
  • Dropped paths containing spaces won't resolve cleanly as @ references (Claude Code ends the ref at whitespace). Matches the file explorer's existing unquoted behavior; can add quoting if wanted.

🤖 Generated with Claude Code

Enable Tauri's OS drag-drop handler (dragDropEnabled: true) so dropping
files onto the window inserts each as an `@<path>` reference into the
active session's prompt, reusing the file explorer's PTY-write path.

The OS handler swallows the webview's HTML5 drag events, so the four
internal drag flows — tab reorder, tab→terminal split-drop, sidebar row
→ section, board card → column, and board column reorder — are rebuilt
on pointer events via a shared `draggable()` primitive. It starts a drag
only past a small threshold (so clicks/context-menus still work),
captures the pointer, hit-tests targets in per-flow onMove/onDrop, and
commits on release (Esc/cancel leaves state untouched).

Tests: the iwft drag helpers now drive real pointer events (page.mouse)
instead of synthetic DragEvents. Unit (49) + iwft (95) pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Ed-Barnes937
Ed-Barnes937 merged commit 112fa89 into main Jul 17, 2026
4 checks passed
@Ed-Barnes937
Ed-Barnes937 deleted the file-drop branch July 17, 2026 09:27
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.

1 participant