openai / openai/codex

CLI: composer Home/End jump to the logical line, not the wrapped visual row (no keymap workaround)

Open
#42,423 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

CLI enhancement TUI
Dominant language
Rust
Stars
125k
Forks
19.4k
PR merge metrics
PR metrics pending

Description

What variant of Codex are you using?

CLI (codex-cli 0.152.1, macOS, Homebrew cask)

What feature would you like to see?

The composer's move_line_start / move_line_end actions operate on the logical line. On a prompt that soft-wraps across several rows, Home/End jump to the start/end of the whole paragraph rather than the start/end of the visual row under the cursor.

Please add wrapped-row variants — e.g. editor.move_visual_line_start / editor.move_visual_line_end — so /keymap can bind them. (Or, if a behaviour change is acceptable, make the existing actions display-aware, which is what macOS native text views and Claude Code's TUI both do.)

The display-row math already exists: editor.move_up / editor.move_down correctly step one visual row at a time. It just isn't exposed as a horizontal motion.

Additional information

Why it matters on macOS: terminals commonly map ⌘←/⌘→ to ESC [ H / ESC [ F, because in every native macOS text view ⌘← goes to the beginning of the visual line. In Codex the same chord overshoots to the paragraph boundary, so the muscle memory is wrong in one app and right everywhere else.

/keymap cannot work around this. TuiEditorKeymap exposes 17 actions and the only horizontal jumps are move_line_start / move_line_end (logical) and move_word_left / move_word_right. Rebinding changes which key fires the action, never what it does — so there is no configuration that produces visual-row behaviour today.

Repro (80-column pane, one soft-wrapped logical line, cursor at the end):

tmux new-session -d -x 80 -y 30 'codex'
tmux send-keys 'AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO PPPP QQQQ RRRR SSSS TTTT UUUU VVVV'
tmux send-keys -H 1b 5b 48          # ESC [ H  == Home
tmux display-message -p '#{cursor_x},#{cursor_y}'

The composer renders as:

> AAAA BBBB CCCC DDDD EEEE FFFF GGGG HHHH IIII JJJJ KKKK LLLL MMMM NNNN OOOO     <- visual row 1
  PPPP QQQQ RRRR SSSS TTTT UUUU VVVV                                             <- visual row 2, cursor here
cursor before ESC [ H cursor after
Codex CLI 0.152.1 row 2, col 36 row 1, col 2 — jumps to the paragraph start
Claude Code (same bytes, same pane size) row 2, col 36 row 2, col 2 — stays on the visual row

Expected: the cursor lands at column 2 of row 2. ESC [ F (End) is symmetric.

Happy to send a PR if you'd take one — the question is whether you'd prefer new actions or changed semantics on the existing ones.

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.

Research direction

Start by tracing the TuiEditorKeymap actions and the existing editor.move_up/move_down visual-row movement, then inspect the composer’s handling of move_line_start and move_line_end. Decide whether to expose separate visual-row actions or change the existing semantics; verify the choice with the 80-column tmux reproduction and confirm Home/End stop at the current wrapped row while remaining bindable through /keymap.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.