Skip to content

Prompt textarea does not support Shift+Arrow text selection #12882

Open

Description

@mexicorea

What variant of Codex are you using?

CLI

What feature would you like to see?

In the prompt input textarea, I cannot select text using keyboard selection shortcuts (Shift + Arrow keys). Cursor movement works, but selection range is not created/highlighted, which makes editing long prompts difficult.

I'd like to see standard keyboard text selection working in the prompt textarea (Shift+Arrow to extend selection), similar to common terminal editors/input widgets.

Additional information

This may be a missing feature rather than a regression, but it significantly impacts usability for long prompts.

Activity

  1. added
    enhancement
    on Feb 26, 2026
  2. added
    CLI
    TUI
    on Feb 26, 2026
  3. removed
    CLI
    on Feb 27, 2026
  4. oxysoft commented on Mar 11, 2026

    @oxysoft

    This issue feels like it should probably be interpreted as the broader baseline selection/editing parity gap in the composer, not only plain Shift+Arrow.

    The concrete set that feels missing:

    • Shift+Left/Right to extend/shrink selection by character
    • word-jump selection (Ctrl+Shift+Left/Right on Win/Linux, platform-appropriate equivalent on macOS)
    • Ctrl+X / cut on the selected range

    Once selection exists, word-wise selection really wants to share the same boundary logic as cursor word navigation, so this also seems related to #12339.

    And at the broader control-surface level, this is another reason #3049 matters: these baseline editing keys should not stay hardcoded forever if Codex wants serious TUI/editor parity.

  5. Gireeshbd commented on Apr 2, 2026

    @Gireeshbd

    I inspected the current TUI composer implementation and this looks like missing functionality rather than a one-off regression.

    Current state on main:

    • TextArea tracks text, cursor_pos, placeholder elements, wrap state, and a single-entry kill buffer, but no selection anchor/range.
    • key handling covers cursor movement, word movement, delete, kill/yank, Home/End, Up/Down, etc., but there is no selection-aware path for Shift+Arrow.
    • because the model only has a single cursor today, there is no way for Backspace / Delete / typed input to operate on a highlighted range.

    A minimal first patch that seems tractable and reviewable would be:

    • add selection state to the composer TextArea
    • support Shift+Left/Right/Up/Down and Shift+Home/End
    • make Backspace / Delete remove the active selection when present
    • make normal typing replace the active selection
    • add focused tests around selection extension, collapse rules, and replacement/deletion behavior

    I’m intentionally not bundling mouse selection or transcript-wide copy behavior into this, since those look like separate design problems.

    If this scope aligns with maintainer intent, I can prepare a patch on that basis.

  6. Gireeshbd commented on Apr 2, 2026

    @Gireeshbd

    I implemented the first scoped slice for this on my fork and pushed it to branch composer-shift-selection.

    Current scope:

    • Shift+Left / Shift+Right selection in the composer textarea
    • Shift+Up / Shift+Down selection across visual lines
    • Shift+Home / Shift+End selection to line boundaries
    • Backspace / Delete remove the active selection
    • typing replaces the active selection
    • focused textarea tests and composer docs updated for the new behavior

    I kept this intentionally limited to keyboard selection/editing in the prompt textarea and did not bundle mouse-selection or transcript-wide copy behavior into the same change.

    If that scope aligns with maintainer intent, I can open a PR from the branch.

  7. Dron007 commented on Apr 14, 2026

    @Dron007

    Additionally in any text input in Windows I often use combinations like

    • Shift+Left/Right to select text
    • Ctrl+Shift+Left/Right to select text quickly by word
    • Ctrl+Backspace to delete word to the left of the caret. Currently Alt+Backspace works instead which if frustrating.
    • Ctrl+Del to delete word to the right of the caret. Also, Alt+Del works instead.

    There is actually no way to select and quickly edit text using keyboard (tested only in Windows).

  8. 2014Alexander commented on May 2, 2026

    @2014Alexander

    I can reproduce the same class of issue with keyboard selection in the Codex CLI composer.

    Environment:

    • Codex CLI 0.128.0
    • Windows
    • Reproducible in a regular PowerShell terminal session

    Reproduction:

    1. Start Codex CLI.
    2. Type a multi-line prompt in the composer.
    3. Place the caret in the middle or at the end of a line.
    4. Press Shift+Home, Shift+End, or Shift+Arrow.

    Expected:

    The editable range inside the composer should become selected.

    Then:

    • typing should replace the active selection;
    • Backspace/Delete should remove the active selection;
    • line-oriented selection should work consistently with character/word-oriented selection.

    Actual:

    The caret moves or no selection-like behavior happens, but no editable selection range is created/highlighted inside the prompt textarea.

    Important distinction:

    This is not terminal screen/scrollback selection for copying rendered output. I agree that terminal screen selection is normally handled by the terminal emulator.

    This request is about editor selection inside the Codex composer input buffer before submitting the prompt.

    That behavior requires application/editor state: a selection anchor/range, selection-aware movement actions, rendering of the selected range, and insert/delete behavior that operates on the active selection.

    Related issue: #20645

  9. kellen-vm commented on Jul 8, 2026

    @kellen-vm

    Bumping this.

    This feels like pretty important functionality despite how many upvotes this issue gets, unless someone has figured out an elegant workaround...

  10. oderebek commented on Nov 14, 2026

    @oderebek

    Adding Windows user feedback and a proposed implementation approach.

    Environment: Windows, Codex CLI 0.167.0 (version checked locally). The user reports that Alt+Shift+Arrow does not select text in the editable prompt. Ctrl+Shift+Left/Right is the usual Windows word-selection shortcut; Alt+Shift+Left/Right could be an optional configurable alternative.

    Selecting and replacing prompt text should be possible entirely from the keyboard inside the CLI. Mouse selection and editing in a separate application do not meet that requirement.

    Source inspection:

    Proposed fix (design suggestion, not an implemented or tested patch):

    1. Generalize/reuse the existing selection range and editing behavior so keyboard input can establish an anchor and extend or shrink the selection.
    2. Add Shift+Arrow and Shift+Home/End selection, plus Ctrl+Shift+Left/Right word selection on Windows. Reuse existing word-boundary and visual-line navigation logic.
    3. Expose selection actions through the editor keymap, allowing Alt+Shift+Left/Right as an optional binding.
    4. Ensure typing/paste replaces the selected range and Backspace/Delete removes it; define consistent selection collapse behavior for unmodified movement.
    5. Add focused tests for reversed selections, wrapped lines, Unicode graphemes, atomic placeholder elements, replacement/deletion, and Windows modifier delivery.

    A terminal-only remap cannot supply missing composer selection semantics. The application needs to handle these actions directly. This builds on earlier proposals in this thread while accounting for the mouse-selection infrastructure now present in 0.167.0.

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

    TUIenhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions