Skip to content

CLI composer cursor drifts after pasting tabs #15146

Closed

Description

@zzho325

What version of Codex CLI is running?

codex-cli 0.115.0

What subscription do you have?

Company-managed Codex account

Which model were you using?

gpt-5.4

What platform is your computer?

Darwin 25.3.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

tmux (TERM=screen-256color); underlying terminal host unknown

What issue are you seeing?

In the TUI composer, pasting text with tab characters can leave the cursor visually offset from the rendered text.

For example, after pasting a string like \t\tabc, the tabs do not appear in the rendered composer text, but the cursor still advances as if the tabs were present. That leaves the cursor too far to the right relative to the visible abc.

This looks like a mismatch between rendering and cursor-position math rather than a generic paste failure.

What steps can reproduce the bug?

  1. Open Codex CLI TUI.
  2. Focus the composer/input box.
  3. Paste text containing leading tabs, for example \t\tabc.
  4. Observe the rendered text and cursor position.

What is the expected behavior?

Rendered text and cursor position should stay aligned. If tabs are not rendered, they also should not advance the cursor position.

Additional information

I did not find an existing GitHub issue covering this exact case.

Likely root-cause direction:

  • the composer cursor math uses unicode-width on the raw textarea string
  • ratatui drops control characters like \t during buffer rendering

That would explain why the tabs disappear visually but still affect cursor placement.

Activity

  1. added
    bug
    CLI
    TUI
    on Mar 19, 2026
  2. removed
    CLI
    on Mar 19, 2026
  3. etraut-openai commented on Oct 12, 2026

    @etraut-openai
    Contributor

    (response from codex)

    Closing as fixed by #33239, included in CLI v0.162.1. Tabs now have a consistent display width in the composer for rendering and cursor positioning, while the original text is preserved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions