Ctrl+V in TUI is image-only when it reaches Codex as a key event; add symmetric text paste

Open 💬 5 comments Opened Apr 8, 2026 by dolzenko
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

## 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+V in 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+V reaches 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+V symmetric for local users whose terminal forwards the keypress

## Local implementation + verification

I implemented this in a local clone and verified with:

  • just fmt
  • cargo clippy -p codex-tui --tests
  • cargo test -p codex-tui

The change includes:

  • text clipboard read helper
  • WSL text fallback
  • Ctrl+V text-first shortcut policy
  • Alt+V image-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.

View original on GitHub ↗

5 Comments

github-actions[bot] contributor · 4 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #16223
  • #15436

Powered by Codex Action

dolzenko · 4 months ago

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.

dolzenko · 4 months ago
sunjiajunsunjiajun · 1 month ago

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:

Failed to paste image: no image on clipboard...

The user is not pasting an image. The likely sequence is:

  1. Text is copied locally / into the remote Windows clipboard.
  2. The remote-control client forwards Ctrl+V as raw key events.
  3. WezTerm does not convert that particular input path into a terminal paste event.
  4. Codex receives raw Ctrl+V.
  5. The TUI handles it as image paste and reports that no image is on the clipboard.

The same machine had a working text-paste path in traditional cmd.exe via 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 passes Ctrl+V through to Codex.

Workarounds that avoid the issue:

  • Use Ctrl+Shift+V or Shift+Insert in WezTerm.
  • Configure WezTerm to bind Ctrl+V to PasteFrom 'Clipboard' so the terminal performs text paste before Codex sees the key event.
  • Add a right-click PasteFrom 'Clipboard' mouse binding in WezTerm, including the mouse_reporting = true case for TUI applications.

This seems like another data point supporting the proposal here: when Ctrl+V reaches 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.

ofirgeller · 19 days ago

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.