fix(renderer): preserve dropped file path formatting#2146
Conversation
Greptile SummaryThis PR fixes drag-and-drop file paths not being pasted correctly into the terminal, specifically for paths that contain spaces (e.g.
Confidence Score: 5/5Safe to merge — the change is narrowly scoped to drag-and-drop path pasting and preserves all existing non-forced bracketed-paste behaviour. The condition restructuring in No files require special attention.
|
| Filename | Overview |
|---|---|
| src/renderer/lib/pty/prompt-injection.ts | Condition refactored so forceBracketedPaste is independent of hasMultilinePayload; all existing semantics preserved for non-forced paths. |
| src/renderer/lib/pty/pty-pane.tsx | Drop handler now uses pastePromptInjection with forceBracketedPaste: true; path escaping extracted to formatDroppedPaths; trailing space preserved outside the bracketed-paste sequence. |
| src/renderer/tests/prompt-injection.test.ts | New test covers single-line content with forceBracketedPaste: true, directly validating the bug fix. |
Sequence Diagram
sequenceDiagram
participant User
participant PtyPane
participant pastePromptInjection
participant buildPromptInjectionPayload
participant Terminal
User->>PtyPane: drag and drop files
PtyPane->>PtyPane: formatDroppedPaths(paths)
PtyPane->>pastePromptInjection: "text, forceBracketedPaste=true"
pastePromptInjection->>buildPromptInjectionPayload: "text, forceBracketedPaste=true"
Note over buildPromptInjectionPayload: forceBracketedPaste=true always wraps, even single-line
buildPromptInjectionPayload-->>pastePromptInjection: ESC[200~path ESC[201~
pastePromptInjection->>Terminal: sendInput with trailing space
Reviews (2): Last reviewed commit: "fix(renderer): keep separator after drop..." | Re-trigger Greptile
summary
example: (bottom left is prod, behind is dev)
https://streamable.com/xtzhyb