Ctrl+V in TUI is image-only when it reaches Codex as a key event; add symmetric text paste
## Summary
In the TUI, Ctrl+V currently behaves as an image-paste shortcut if it reaches Codex as a key event.
That means when the clipboard contains text, and the terminal does not convert the paste into a bracketed Paste(...) event, Codex tries to
paste an image instead and shows an error like:
> Failed to paste image: no image on clipboard: ...
## Root cause
There are currently two different paste paths:
- text paste: relies on terminal/crossterm
Event::Paste(...) Ctrl+V: handled as clipboard image paste in the TUI keybinding layer
So if the terminal forwards Ctrl+V as a keypress instead of surfacing a paste event, text paste does not happen inside Codex.
## Proposed behavior
Ctrl+Vin local desktop sessions:- try clipboard text first
- if non-empty text exists, route it through the existing composer paste path
- if no text exists, fall back to image paste
Alt+V:- remain explicit image paste
- SSH/remote sessions:
- do not do process-local text clipboard reads
- rely on terminal-owned paste
- if
Ctrl+Vreaches Codex as a key event, show a short hint instead of reading the remote process clipboard
## Why this shape
- preserves terminal-native
Paste(...)handling - preserves explicit image paste
- avoids incorrect clipboard semantics in SSH sessions
- makes
Ctrl+Vsymmetric for local users whose terminal forwards the keypress
## Local implementation + verification
I implemented this in a local clone and verified with:
just fmtcargo clippy -p codex-tui --testscargo test -p codex-tui
The change includes:
- text clipboard read helper
- WSL text fallback
Ctrl+Vtext-first shortcut policyAlt+Vimage-only policy- SSH hint path
- updated footer/snapshots/tests
If this approach matches the intended direction, I can turn it into a PR if invited.
5 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
A little more context - https://github.com/openai/codex/issues/4818#issuecomment-4192146355 I originally needed this for implementing cross-layout Ctrl-V paste with alacritty
https://github.com/openai/codex/issues/16223 is also very likely might be solved with this change.
https://github.com/openai/codex/commit/a64505379 the changeset codex gave me
This root-cause explanation matches another real-world reproduction path.
In a Windows remote-control setup using UU remote connection + WezTerm, plain text paste can fail with the image-paste error:
The user is not pasting an image. The likely sequence is:
Ctrl+Vas raw key events.Ctrl+V.The same machine had a working text-paste path in traditional
cmd.exevia mouse right-click paste, which suggests the text clipboard can be fine and the failure depends on whether the terminal consumes the paste shortcut or passesCtrl+Vthrough to Codex.Workarounds that avoid the issue:
Ctrl+Shift+VorShift+Insertin WezTerm.Ctrl+VtoPasteFrom 'Clipboard'so the terminal performs text paste before Codex sees the key event.PasteFrom 'Clipboard'mouse binding in WezTerm, including themouse_reporting = truecase for TUI applications.This seems like another data point supporting the proposal here: when
Ctrl+Vreaches Codex as a key event, Codex should either try text clipboard content first in local desktop sessions, or show a text-paste hint instead of immediately taking the image-paste path.Please fix this. I'm unwilling to type into the console like a peasant, and this is also blocking voice to text with programs like blabby.
i should be able to use ctrl + v for pasting both images, text and the results of vtt.