Skip to content

Conversation

@TakashiKyoto
Copy link

@TakashiKyoto TakashiKyoto commented Jan 15, 2026

What does this PR do?

Fixes #6560
Complementary to #8209 which fixes image filename extraction from Windows
file copy. This PR focuses on text paste failures and PowerShell escaping issues.

Ctrl+V paste was silently failing on Windows/WSL2 for text containing file
extensions (e.g., image.png, c:\path\file.txt).
Root cause: Bun.file().type infers MIME from extension without checking if file
exists. Text like image.png was treated as an image file path, failed to load,
and silently dropped. Additionally, on WSL2, clipboardy uses Linux clipboard
tools which cannot access Windows clipboard.

Fix:

  • Added file.exists() check before treating pasted text as file path
  • Added PowerShell clipboard read for Windows/WSL2 (using -EncodedCommand to
    avoid quoting issues with backslash paths)
  • Added explicit text paste handler in onKeyDown for terminals without
    bracketed paste support

How did you verify your code works?

Manually tested - pasting image paths now works perfectly in windows 11 WSL2 environment.

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, here are the related PRs I found:

Related PRs:

  1. fix(tui): support clipboard image paste with proper filename on WSL2 #8209 - fix(tui): support clipboard image paste with proper filename on WSL2

  2. feat: add input_copy and input_cut keybindings for keyboard-based text selection #7520 - feat: add input_copy and input_cut keybindings for keyboard-based text selection

  3. fix(clipboard): add OSC 52 fallback for SSH/tmux environments #7028 - fix(clipboard): add OSC 52 fallback for SSH/tmux environments

The most directly related is #8209, which is already referenced in the current PR description as a complementary fix.

@TakashiKyoto TakashiKyoto force-pushed the fix/paste-windows-wsl2 branch from 1b4134d to 2a9fb0f Compare January 16, 2026 07:05
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.

Paste into Powershell OpenCode instance not working

1 participant