Skip to content

feat(terminal): drop files to paste shell-quoted paths#247

Open
sanztheo wants to merge 3 commits into
crynta:mainfrom
sanztheo:feat/terminal-file-drop
Open

feat(terminal): drop files to paste shell-quoted paths#247
sanztheo wants to merge 3 commits into
crynta:mainfrom
sanztheo:feat/terminal-file-drop

Conversation

@sanztheo
Copy link
Copy Markdown

What

Drop files or folders onto a terminal pane to paste their paths, properly shell-quoted, at the cursor.

Why

Typing or escaping long paths (especially with spaces) is tedious. The explorer already supports dragging paths into the agent context (#230); the terminal had no equivalent.

How

  • New dropPaths helper handles POSIX single-quote escaping and Windows-style backtick quoting based on path shape.
  • TerminalStack registers a drop handler that resolves the active session and pastes the quoted paths (space-separated, trailing space for chaining).
  • useTerminalSession exposes the paste API; TerminalPane plumbs the drop target.

Testing

  • pnpm exec tsc --noEmit clean
  • Manual smoke-test of the affected feature
  • (If you touched src-tauri/) cargo check clean — not touched
  • (If UI) tested in pnpm tauri dev

Flows exercised:

  • Single file with spaces in name → quoted with '…', trailing space inserted
  • Multiple files → space-separated quoted paths
  • Windows-style path (C:\Users\…) → backtick-escaped double quotes
  • Drop mid-command → text appended at cursor, no replace of buffer

Screenshots / GIFs

To add — terminal pane receiving a drag-and-drop of two files with spaces.

Notes for reviewer

  • Quoting follows POSIX '…' with '\'' escape sequence; same approach as common shells (no shell expansion inside).
  • Heuristic for Windows path detection is regex-based (^[A-Za-z]:[\\/], UNC, contains \); open to a stricter signal if needed.

@sanztheo sanztheo requested a review from crynta as a code owner May 14, 2026 16:03
- Strip control characters (CR/LF/NUL) defensively before quoting; bracketed
  paste protects most cases but the input crosses an OS boundary, so the
  helper should not assume tidy values.
- Tighten the input filter to a typed predicate; `Boolean` accepts any
  truthy value and weakens the type signal.
- Document that the Windows branch targets PowerShell-style escaping; cmd
  treats the backticks as literals, which is fine since filenames cannot
  contain `"` on Windows.
@sanztheo sanztheo force-pushed the feat/terminal-file-drop branch from d134760 to 6808cf8 Compare May 14, 2026 16:07
Adopt upstream's slot-based terminal architecture (focusSlot/getSlotForLeaf)
while preserving the paste() callback added by the file-drop feature.
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