2 Commits

Author SHA1 Message Date
HugoAir Dev 5cd9c016d1 fix(coding-agent): spawn the WSL text clipboard read async and route the text fallback by focus
Address review notes on #2248:

- readTextFromClipboard's WSL branch now mirrors readImageViaPowerShell
  (Bun.spawn + kill timer sharing POWERSHELL_TIMEOUT_MS) instead of
  execSync, so a cold powershell.exe start cannot block the TUI event
  loop on the first smart-paste miss.
- The smart-paste text fallback routes through ui.getFocused() +
  hasPasteText like the enhanced-paste text path, so the payload lands
  in focused modal Input prompts instead of the hidden main editor
  (#2127 contract). Covered by a new routing test.
2026-06-10 17:59:57 +09:00
HugoAir Dev 765b972a00 feat(coding-agent): fall back to text paste when clipboard holds no image
app.clipboard.pasteImage dead-ended with a status message when the
clipboard held text, which made the chord useless on hosts that only
deliver that one keypress (VS Code's integrated terminal forwarding
Ctrl+V, Windows clipboard history via Win+V simulating Ctrl+V).

- handleImagePaste now pastes clipboard text through the editor's
  paste semantics when no image is available; an empty clipboard
  reports 'Clipboard is empty'.
- readTextFromClipboard reaches the Windows clipboard through host
  PowerShell under WSL (mirroring readImageFromClipboard), with CRLF
  normalization and UTF-8 output encoding.
- handleClipboardTextRawPaste's empty-clipboard status message moved
  to the actual empty branch (was shown after successful pastes).
- Clipboard reads are constructor-injectable for tests.

Implements proposal 1 of #1628.
2026-06-10 17:46:46 +09:00