Skip to content

fix(tui): remove duplicate image paste on Windows/WSL right-click#1721

Open
NikoDi2000 wants to merge 1 commit into
XiaomiMiMo:mainfrom
NikoDi2000:fix/right-click-image-paste-duplicate-v2
Open

fix(tui): remove duplicate image paste on Windows/WSL right-click#1721
NikoDi2000 wants to merge 1 commit into
XiaomiMiMo:mainfrom
NikoDi2000:fix/right-click-image-paste-duplicate-v2

Conversation

@NikoDi2000

Copy link
Copy Markdown

Summary

  • 删除 app.tsxonMouseDownpromptRef.current?.paste() 调用
  • 该调用与终端自身的 bracketed paste 机制重复触发,导致 Windows/WSL 下右键粘贴图片被插入两次

Root Cause

MiMoCode fork 时在 onMouseDown 中新增了 promptRef.current?.paste(),上游 opencode 没有这个调用。在 Windows Terminal 中,右键会同时触发:

  1. 终端的 bracketed paste → onPastepasteFromClipboard()
  2. App 的 onMouseDownpromptRef.current?.paste()pasteFromClipboard()

文本粘贴不受影响,因为 onPaste 直接拿到文本内容处理,不走 pasteFromClipboard()

Test

  • Windows Terminal + WSL 下右键粘贴图片,确认只插入一张
  • Ctrl+V 粘贴文本正常
  • Ctrl+V 粘贴图片正常

Fixes #1720

Remove promptRef.current?.paste() from onMouseDown handler.
This call duplicated the terminal's own bracketed paste mechanism,
causing images to be pasted twice on Windows/WSL.

Fixes XiaomiMiMo#1720
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.

右键粘贴图片在 Windows/WSL 下重复插入两张

1 participant