Ctrl+V Paste Fix Report — MiMo Code on Windows
Description
Hello!
Problem Description
On Windows (both classic Console/conhost and Windows Terminal), the Ctrl+V keyboard shortcut does not paste text from the clipboard into MiMo Code's TUI input field. Right-click paste also fails in some environments.
Root Cause Analysis
After investigating, I identified four distinct bugs that together prevent clipboard paste from working correctly in Windows environments (Console, Windows Terminal, and compiled Bun binary):
-
Ctrl+V handler – In
prompt/index.tsx, theonKeyDownforinput_pastedid not calle.preventDefault()for text pastes. It relied on bracketed-paste support, which is not available in Windows Console/ConPTY. As a result, the default browser/terminal paste behavior took over, and the TUI never received the paste event. -
Double‑submission guard – Rapid Enter presses or pastes that include trailing newlines triggered multiple deferred submissions, leading to duplicate sends or erratic behavior.
-
Clipboardy / Bun binary – The
clipboardypackage relies onclipboard_x86_64.exebeing located viaimport.meta.url. In a compiled Bun binary (mimo.exe),import.meta.urlresolves to a virtual path, so the executable cannot be found and executed. -
UTF‑8 encoding – When
clipboardyfalls back to PowerShell, it outputs text in the system default encoding (e.g., Windows‑1251 for Russian), not UTF‑8. This caused mojibake for non‑ASCII characters (Cyrillic, etc.).
Solution
I have created two patches that address all four issues:
mimo_ctrlv_windows.patch– fixes the Ctrl+V handler (addse.preventDefault(), callspastePlainText()directly) and adds a submission guard to prevent double‑send.mimo_clipboard_bun_binary.patch– replaces the clipboard mechanism with a PowerShell‑based reader that forces UTF‑8 output and works reliably in the compiled Bun binary.
The patches are available in my public repository:
👉 https://github.com/N-verner-A/mimo-code-patches
How to Apply
- Clone the official MiMo Code repository:
git clone https://github.com/XiaomiMiMo/MiMo-Code.git cd MiMo-Code - Download the patches from the above repository and apply them using
git am:git am < /path/to/mimo_ctrlv_windows.patch git am < /path/to/mimo_clipboard_bun_binary.patch - Rebuild the CLI:
cd packages/opencode bun run build --single - The compiled binary will be at
packages/opencode/dist/mimocode-windows-x64/bin/mimo.exe.
Tested Scenarios
- Windows 10 & 11
- PowerShell, Windows Terminal, and classic conhost
- English and Russian (Cyrillic) text
- Single‑line and multi‑line paste
- Image clipboard (unchanged) – not affected
- Compiled
mimo.exe(Bun’s--compile)
Environment
- MiMo Code version: 0.1.1
- Binary version: 0.0.0-main-202606181748
- Base commit:
98c283a
Note: These patches are specific to the current 0.1.1 release. If upstream changes significantly, they may need to be rebased or re‑applied. I hope this can be merged or at least serve as a reference for a proper fix.
Plugins
No response
MiMoCode version
0.1.1
Steps to reproduce
- Run MiMoCode in Windows PowerShell or in cmd;
- Copy text to clipboard;
- Try to paste using right-click or Ctrl+V, or Ctrl+Shift+V, or Shift+Insert;;
- Nothing happens - no text is pasted.
Screenshot and/or share link
No response
Operating System
Windows 10
Terminal
Windows PowerShell, cmd
thanks, it has already solved in next version !