Codex CLI inserts leading spaces into rendered command blocks, breaking copy/paste of long shell commands
What version of Codex CLI is running?
codex-cli 0.117.0
What subscription do you have?
Pro
Which model were you using?
gpt-5.4 medium
What platform is your computer?
Darwin 25.3.0 arm64 arm
What terminal emulator and version are you using (if applicable)?
iTerm2
What issue are you seeing?
Because the CLI has two spaces in the left-hand column, when copying and pasting multi-line shell commands it gives me which have long lines, line wrap is broken because the paste includes the two spaces.
What steps can reproduce the bug?
Ask Codex to create a CLI command or any text with long lines which wrap from one line to the other. Copy the line from the terminal and paste into e.g. another text editor. The long lines will be broken up into two separate lines.
What is the expected behavior?
Paste should be onto a single line. See screenshot where the "barcodes-edit-20.csv" text is on a new line than the text at the end of the previous screen row. It should be the same line.
<img width="222" height="388" alt="Image" src="https://github.com/user-attachments/assets/284b650d-7302-46a9-9e80-06019ed24ce3" />
Additional information
_No response_
5 Comments
You literally can't copy and paste anything that appears in TUI without manually copying it in an editor and fix it: every line is wrapped and/or preceded by space. The Codex app is better in this regard.
The current behavior is by design, so we don't consider this a bug.
If you'd like to see this behavior changed, please upvote #9252.
If this behaviour is by "design" this is one of the worst designs ever... learn from Opencode ffs, this is garbage.
Your "by design" comment is highly triggering. Anyone with common sense can see adding two spaces in front of each multi-line code block that someone might want to copy and paste into a terminal or somewhere else is bad design.
This is by far a frustration.
Please listen to your users.
Copying from codex especially for heredoc, or scripts adds a extra work. When i'm sshing into other servers that i can't run codex on I have to copy, past to vim / notes remove the extra spaces then copy and finally paste into the terminal. If you don't want to fix the visuals make sure it copies without the extra space.
For stuff like this I've started to close down codex and use opencode.