TUI copies left padding spaces from code blocks

Open
#33,581 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
rust
Domain
cli

Research direction

Reproduce the issue in the terminal TUI in normal mode and with --no-alt-screen, then trace the TUI code-block rendering and terminal-copy paths. Done means copying a fenced code block preserves its code content without the two-space layout padding in both modes, with coverage for indentation-sensitive snippets.

Written by the indexing model from the issue text.

Description

bug CLI TUI

When using Codex CLI in the terminal TUI, assistant messages and fenced code blocks are rendered with a two-space left padding/gutter. When selecting and copying code from the terminal, these two leading spaces are copied as part of every line.

This makes pasted shell scripts, Python heredocs, YAML, and other indentation-sensitive snippets invalid or annoying to clean manually.

Tested with:

  • Codex CLI 0.142.4
  • normal TUI mode
  • --no-alt-screen
  • terminal scrollback copy still includes the same two leading spaces

Expected behavior:
Copying a fenced code block should copy only the code content, without TUI layout padding.

Actual behavior:
Every copied line starts with two extra spaces.

Request:
Add a way to copy code blocks without layout padding, or add a config/flag to render assistant code blocks without the left gutter/padding.

Dominant language
Rust
Stars
125k
Forks
19.5k
Avg merge
1m
Merged PRs (30d)
1k

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openai/codex

All issues in openai/codex

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.