Skip to content

Add full text selection support to the CLI composer #20645

@2014Alexander

Description

@2014Alexander

What variant of Codex are you using?

CLI

What feature would you like to see?

Please add a full text selection model to the Codex CLI composer.

Right now the inline composer supports cursor movement and kill/yank-style editing well enough for short prompts, but it falls short once prompts
become multi-line and need normal text selection behavior.

Examples of expected editor behavior that appear to be missing or inconsistent:

  • Shift+Left / Shift+Right
  • Shift+Up / Shift+Down
  • Shift+Home / Shift+End
  • Ctrl+Shift+Left / Ctrl+Shift+Right
  • Ctrl+Shift+Home / Ctrl+Shift+End

In particular, selecting to the beginning/end of the current line is important for editing multi-line prompts inline.

Why this matters

The external editor (Ctrl+G) is a useful fallback, but it is much heavier than doing quick inline edits in the composer.

When editing prompts directly in the TUI, the lack of normal selection behavior makes common tasks harder than they should be, for example:

  • replacing part of a line
  • selecting a whole line segment
  • selecting across wrapped or multiple lines
  • making small edits without jumping out to the external editor

Expected behavior

The composer should behave more like a normal terminal text editor / textarea:

  • cursor movement should have selection-extending equivalents
  • typing should replace the active selection
  • backspace/delete should remove the active selection
  • selection should work consistently for character, word, and line-oriented motions

Additional information

This looks like a feature gap rather than a single broken shortcut.

From the current code structure:

  • EditorKeymap exposes movement, deletion, kill, and yank actions, but no select_* actions
  • the composer TextArea appears to track text, cursor position, wrapping, elements, and kill buffer state, but not an explicit selection anchor/
    range
  • Home / End are wired as movement actions, not selection-extending actions

Relevant files:

  • codex-rs/tui/src/keymap.rs
  • codex-rs/tui/src/bottom_pane/textarea.rs

A reasonable implementation path would likely be:

  1. add selection state to the composer textarea
  2. add selection-aware editor actions / keybindings
  3. render highlighted selected ranges
  4. make insert/delete operations replace an active selection
  5. preserve correct behavior with atomic elements and vim mode

Metadata

Metadata

Assignees

No one assigned

    Labels

    TUIIssues related to the terminal user interface: text input, menus and dialogs, and terminal displayenhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions