feat(terminal): drop files to paste shell-quoted paths#247
Open
sanztheo wants to merge 3 commits into
Open
Conversation
- 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.
d134760 to
6808cf8
Compare
Adopt upstream's slot-based terminal architecture (focusSlot/getSlotForLeaf) while preserving the paste() callback added by the file-drop feature.
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.
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
dropPathshelper handles POSIX single-quote escaping and Windows-style backtick quoting based on path shape.TerminalStackregisters a drop handler that resolves the active session and pastes the quoted paths (space-separated, trailing space for chaining).useTerminalSessionexposes the paste API;TerminalPaneplumbs the drop target.Testing
pnpm exec tsc --noEmitcleansrc-tauri/)cargo checkclean — not touchedpnpm tauri devFlows exercised:
'…', trailing space insertedC:\Users\…) → backtick-escaped double quotesScreenshots / GIFs
To add — terminal pane receiving a drag-and-drop of two files with spaces.
Notes for reviewer
'…'with'\''escape sequence; same approach as common shells (no shell expansion inside).^[A-Za-z]:[\\/], UNC, contains\); open to a stricter signal if needed.