Skip to content

Implement copy paste for images#20

Merged
nedtwigg merged 21 commits intomainfrom
copy-paste-images
Apr 22, 2026
Merged

Implement copy paste for images#20
nedtwigg merged 21 commits intomainfrom
copy-paste-images

Conversation

@nedtwigg
Copy link
Copy Markdown
Member

No description provided.

nedtwigg and others added 9 commits April 20, 2026 23:46
…n smart-token

Error-location tokens like "src/foo.ts:42." (common in compiler output
where a sentence ends with a file:line reference) were not detected
because the error-location regex was tested against the raw token with
skipStrip:true, so the trailing period prevented the regex $ anchor
from matching.

Fix: strip trailing punctuation once up front, then test all patterns
against the cleaned token. The skipStrip flag is removed since all
patterns now benefit from uniform stripping. Added a regression test
for error-location-with-trailing-period.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Apr 22, 2026

Deploying mouseterm with  Cloudflare Pages  Cloudflare Pages

Latest commit: 22c9b16
Status: ✅  Deploy successful!
Preview URL: https://9d0e3ad2.mouseterm.pages.dev
Branch Preview URL: https://copy-paste-images.mouseterm.pages.dev

View logs

nedtwigg and others added 12 commits April 22, 2026 15:33
microsoft/vscode#111092 closed this as out-of-scope. The DOM onDrop
handler on TerminalPane never fired in either build anyway (Tauri
intercepts natively via WindowEvent::DragDrop). Remove the dead
saveDroppedBytesToTempFile plumbing across platform adapters, message
router, Tauri command, sidecar, and tests; update spec §8.7 / §9.2.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
… detect

- Drop DEBUG/debugLog infrastructure, the ensureDir/fileNonEmpty/silentUnlink/
  dropsFilePath/collectSpawnStdout wrappers, and the parallel `spawn` code path
  in the linux image branch. Use execFile with { encoding: 'buffer' } to reuse
  the single `exec` runtime hook for binary output, and inline mkdir/stat/unlink
  in readClipboardImageAsFilePath.
- Compute IS_WINDOWS once at module load in shell-escape.ts instead of sniffing
  navigator on every shellEscapePath call, matching IS_MAC's pattern.

Net: ~75 fewer lines in clipboard-ops.js; all 249 lib tests and all 10
clipboard-ops tests still pass.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Locks in the file-ref → text → image ordering and the invariant that
`readClipboard.readText` is never called when file refs are present
(avoids the macOS WKWebView paste-permission popup documented in
clipboard.ts).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Swap `new RegExp(string)` back for literals. The string form added a
layer of backslash-escaping (e.g. `'^[A-Za-z]:\\\\\\S*$'`) with no
motivating reason. Literals parse once at module load and read more
directly.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Pure formatting, no behavior change — shouldn't have ridden along in
the clipboard PR.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Covers the Mac/Linux → posix and Windows → windows branching in
shellEscapePath, which was previously only tested via its two
sub-functions in isolation. Uses vi.resetModules + navigator stubs
to re-import the module under each simulated platform.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Backslash-escaping newlines produces `\<newline>`, which bash reads as
a line continuation and swallows both characters — so a file named
\`foo\\nbar.txt\` pasted at the terminal becomes \`foobar.txt\`, silently
corrupting legal Unix filenames. Fall back to single-quote wrapping
when the path contains \\n or \\r, using the '\\'' idiom to embed
literal single quotes. Updates the misleading "security: prevents
command injection" test comment — this was never about injection, only
round-trippability.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Each image paste creates \$TMPDIR/mouseterm-drops-XXXX/<uuid>.png. In a
long-lived sidecar these accumulated until the OS cleaned /tmp, which
on macOS is per-user and persistent. Schedule an unref'd timer to
remove the file and its parent directory 5 minutes after it's created
— long enough that \`claude\`, \`cat\`, \`open\`, etc. have read it.

The TTL is injectable via \`runtime.setTimeoutFn\` so tests can capture
the scheduled callback without waiting.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@nedtwigg nedtwigg merged commit 6833f1b into main Apr 22, 2026
6 checks passed
@nedtwigg nedtwigg deleted the copy-paste-images branch April 22, 2026 23:42
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