feat: word-based text navigation and deletion

Resolved 💬 2 comments Opened Apr 26, 2025 by vshuraeff Closed Aug 7, 2025
💡 Likely answer: A maintainer (tibo-openai, collaborator) responded on this thread — see the highlighted reply below.

Feature Request: Implement Word-Based Text Navigation and Deletion

Description:
Introduce standard keyboard shortcuts using modifier keys (Alt/Option, potentially Cmd depending on platform standards) for word-level operations within text input fields. This includes moving the cursor word by word and deleting entire words at a time.

Motivation:
Currently, navigating and editing text often requires character-by-character actions, which is inefficient for larger edits. Implementing word-based shortcuts aligns with standard OS-level text editing behaviour, significantly improving editing speed and user experience.

Acceptance Criteria:

  1. Cursor Movement:
  • Pressing Alt/Option + Right Arrow moves the cursor to the beginning of the next word.
  • Pressing Alt/Option + Left Arrow moves the cursor to the beginning of the current or previous word.
  1. Word Deletion:
  • Pressing Alt/Option + Backspace deletes the word immediately preceding the cursor (and any preceding whitespace).
  • Pressing Alt/Option + Delete (or Fn+Alt/Option+Backspace on some keyboards) deletes the word immediately following the cursor (and any following whitespace).
  1. Selection (Optional but Recommended):
  • Combining Shift with the Alt/Option + Arrow Key combinations selects text word by word.

Usage Examples:

  1. Correcting a typo:
  • User typed: "Hello brave neww world"
  • Cursor is at the end.
  • Press Alt/Option + Left Arrow once -> cursor moves before "world".
  • Press Alt/Option + Left Arrow once more -> cursor moves before "neww".
  • Press Backspace once -> deletes the extra 'w'.
  1. Deleting a word:
  • User typed: "This is some sample text"
  • Cursor is after "sample ".
  • Press Alt/Option + Backspace once -> deletes "sample " -> "This is text".
  1. Replacing a word:
  • User typed: "Use the blue button"
  • Wants to replace "blue" with "green".
  • Place cursor before "blue".
  • Hold Shift + Alt/Option, press Right Arrow once -> selects "blue ".
  • Type "green " -> replaces selection -> "Use the green button".

View original on GitHub ↗

2 Comments

tibo-openai collaborator · 1 year ago

Cursor movement should work on latest version, could you double check that there are issues here or let me know if actually does work?

For word deletion, this is being improved in https://github.com/openai/codex/pull/685

codex-maintainers · 1 year ago

Thank you for the feedback! Please try the latest version of Codex CLI to see if this issue persists. If it does, we're happy to take a look at a PR to the codex-rs/ implementation.