[BUG] Drag-and-dropping multiple files into the CLI prompt only attaches the first one (paste handler treats the whole drop as a single path)
Preflight Checklist
- [x] I have searched existing issues and this is not a duplicate (closest: #84251 macOS placeholder bug, #81544 VS Code extension DnD — neither covers this)
- [x] I am using the latest version of Claude Code (2.1.246)
- [x] This is a bug report, not a feature request or question
What's Wrong?
Dragging several files from a file manager onto the Claude Code prompt only attaches the first one. The remaining files are silently ignored.
The terminal is not the problem: kitty inserts every dropped path into the input as one paste, shell-quoted and space-separated, e.g.
'/home/me/a.png' '/home/me/b.png' '/home/me/c.png'
Claude Code's paste handler assumes the whole paste is a single path. From the 2.1.246 bundle, the detection helper does roughly:
function at(e){
let t = Ee(e.trim()); // strips ONE pair of surrounding quotes
let i = Se(t); // unescapes backslashes
if (_e.test(i)) return i; // tests the ENTIRE string as one path
return null;
}
There is no tokenising of a multi-path paste, so with N dropped files at most one image ends up as [Image #1]; the others are never read or attached.
What Should Happen?
A multi-file drop should attach every dropped image ([Image #1], [Image #2], …), the same result you get today by dropping the files one at a time. Non-image paths in the same drop should stay as text (or be @-referenced), as they are now.
Suggested fix: split the pasted text into shell-quoted tokens (handling '…', "…", and backslash-escaped spaces, which is how kitty/GNOME Terminal/iTerm2/Windows Terminal all emit drops), then run the existing per-path image detection on each token.
Error Messages/Logs
None — the extra files are dropped silently, nothing is logged.
Steps to Reproduce
- Open
claudein kitty (any terminal that inserts dropped paths should behave the same). - In a file manager, multi-select 3 image files (e.g. PNG screenshots).
- Drag the selection onto the Claude Code prompt.
- Observe: only
[Image #1]is attached. Send the message — the model sees one image. - Control: drag the same 3 files one by one —
[Image #1],[Image #2],[Image #3]all attach correctly.
Claude Model
Not model-related (input handling in the TUI).
Is this a regression?
Not sure — it's never worked for me, and the built-in tip ("Did you know you can drag and drop image files into your terminal?") suggests it was only ever designed for one file.
Claude Code Version
2.1.246 (installed via mise)
Platform
CLI (terminal)
Operating System
Linux — Arch Linux, kernel 7.1.9, Hyprland/Wayland (Omarchy)
Terminal/Shell
kitty 0.48.2 / bash
Additional Information
kitty's drop behaviour (paths shell-escaped and space-joined) is documented in its changelog since 0.14, so the paste Claude Code receives is deterministic and easy to parse.