GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): support clipboard image paste with proper filename on WSL2 by mmdsnb · Pull Request #8209 · anomalyco/opencode

Conversation

@mmdsnb

@mmdsnb mmdsnb commented Jan 13, 2026

Copy link
Copy Markdown

Summary

Fixes clipboard image pasting in WSL2 terminal environment. When users copy image files from Windows file manager and paste into OpenCode TUI, the full Windows path (e.g., D:\temp\image.png) was being displayed instead of just the filename.

Changes

1. Enhanced Clipboard Reading (clipboard.ts)

  • Added support for ContainsFileDropList() to detect copied image files on Windows
  • Automatically extract filename from Windows file paths
  • Convert Windows paths to WSL paths (D:\... → /mnt/d/...)
  • Return filename in Clipboard.Content interface

2. Fixed Paste Event Handling (prompt/index.tsx)

  • Call event.preventDefault() immediately in onPaste to prevent default text insertion
  • Check clipboard for images before processing pasted text
  • Manually handle text insertion for all paste scenarios
  • Use extracted filename instead of "clipboard" label

Testing

Tested on WSL2 with Windows Terminal:

  1. ✅ Copy image file from Windows file manager (Ctrl+C) → Paste (Ctrl+V)
  2. ✅ Drag image file from file manager to terminal window
  3. ✅ Copy image from application (e.g., browser) → Paste
  4. ✅ Normal text pasting still works correctly

Before

D:\temp\ScreenShot_2026-01-13_191354_854.png [Image 1]

After

ScreenShot_2026-01-13_191354_854.png [Image 1]

Technical Details

  • PowerShell script now outputs FILEPATH: prefix to indicate file path source
  • Path conversion only happens in WSL environment (detected via os.release())
  • No performance impact on normal text pasting (< 500 chars check optimization)

Fixes #issue-number-if-exists

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
mengfud
fix(tui): support clipboard image paste with proper filename on WSL2
7e8b089
- Add support for copying image files from Windows file manager (Ctrl+C)
- Automatically convert Windows paths to WSL paths (D:\... -> /mnt/d/...)
- Extract and display only filename instead of full path
- Fix onPaste event handling to prevent duplicate text insertion
- Add FileDropList detection in PowerShell clipboard script

Fixes issue where pasted images showed full Windows path instead of filename
in WSL2 terminal environment.
@github-actions github-actions Bot added the needs:issue label Jan 13, 2026
@github-actions

github-actions Bot commented Jan 13, 2026

Copy link
Copy Markdown
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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Jan 13, 2026

Copy link
Copy Markdown
Contributor

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

No duplicate PRs found

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TakashiKyoto TakashiKyoto mentioned this pull request Jan 15, 2026
fix(tui): fix Ctrl+V paste on Windows/WSL2 (#6560 and #8209) #8626
Closed
This was referenced Jan 18, 2026
fix: Windows evaluating text on copy #9293
Merged
feat: cmd+v paste files #9440
Closed
@R44VC0RP R44VC0RP mentioned this pull request Jan 25, 2026
Attachements do not work on WSL #1202
Closed
@thdxr
thdxr force-pushed the dev branch from cbab81f to 2d3c7a0 Compare January 30, 2026 04:50
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 00637c0 to 71e0ba2 Compare January 30, 2026 14:32
@thdxr
thdxr force-pushed the dev branch 3 times, most recently from f1ae801 to 08fa7f7 Compare January 30, 2026 14:37
This was referenced Feb 8, 2026
fix(desktop): add native clipboard image paste and fix text paste #12682
Merged
fix(tui): make Windows image paste reliable #13161
Closed
This was referenced Feb 16, 2026
fix: Ctrl+V paste not working on Windows 11 TUI #13798
Closed
fix: handle text clipboard paste on Ctrl+V for Windows terminals #13871
Closed
This was referenced Mar 14, 2026
feat(tui): improve drag-drop image path handling for tool access #17489
Closed
fix(tui): add Alt+V as fallback keybind for image paste on Windows Terminal #17539
Closed
@github-actions

github-actions Bot commented Mar 15, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

needs:issue

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@mmdsnb
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.