Support mouse click to move cursor in TUI input box
Summary
Add mouse event handling to the Codex CLI's TUI input box so users can click directly to move the cursor, instead of relying on keyboard navigation only.
Background
This was previously requested in #14315, which was closed due to insufficient upvotes. Reopening / re-requesting because the need still stands and modern terminals increasingly support this interaction (Ghostty 1.3.0+, Kitty, WezTerm, etc.).
Use case
When editing a long prompt in the Codex CLI input box, repositioning the cursor with arrow keys / Ctrl+A / Ctrl+E is slow. Clicking the desired position with the mouse — like in any GUI text field or shells such as Fish 4.1+ / Nushell 0.111+ inside Ghostty — would be significantly faster.
Proposal
Enable mouse capture in the TUI and translate click coordinates to cursor positions inside the multiline input widget. Compatible with terminals that support OSC 133 click-events / cl=line or Kitty's click_events.
References
- Previous closed issue: #14315
- Ghostty click-to-move-cursor docs: https://ghostty.org/docs/install/release-notes/1-3-0#click-to-move-cursor-in-shell-prompts
4 Comments
Potential duplicates detected. Please review them and close your issue if it is a duplicate.
Powered by Codex Action
I’ve implemented this locally with tests and verified it in the TUI. It adds left-click cursor positioning inside the composer while ignoring other mouse events. Would a maintainer be open to inviting a PR for this? @etraut-openai
https://github.com/user-attachments/assets/5a9d74f2-096c-425c-9243-096ba8c385b3
I would really appreciate this feature as well. I frequently work with long prompts in Codex CLI, and repositioning the cursor with arrow keys is significantly slower than simply clicking at the desired position.
+1 for implementing this.
This feature has been in claude code and open code for a while now. Would be great if we can have this in codex too.