Skip to content

Mouse drag selection + copy in the TUI #19820

@hamsar4j

Description

@hamsar4j

What variant of Codex are you using?

CLI

What feature would you like to see?

Summary

Add mouse drag selection support to the Codex TUI so users can select text from both the output area and the input composer, automatically copy the selected text to the clipboard, and show a short Copied to Clipboard notification.

Motivation

When reviewing generated output, commands, paths, errors, or pasted prompt text, it is useful to quickly select and copy text directly from the TUI. Today, copying text from terminal applications can be inconsistent, especially when mouse capture, alternate screen behavior, scrollback, and input widgets are involved.

This would make common workflows smoother:

  • Copy a command or file path from assistant output.
  • Copy part of an error message.
  • Copy selected text from the input composer before submitting.
  • Select partial lines rather than only whole rows.

Proposed behavior

Image
  • Enable mouse drag selection in the TUI.
  • Allow selection in the output/history area.
  • Allow selection in the input composer area.
  • Support partial-line and multi-line selections.
  • On mouse release, copy selected non-empty text to the clipboard.
  • Show a Copied to Clipboard notification after a successful copy.
  • Show a copy failure message if clipboard access fails.
  • Make the selected region visibly highlighted while dragging.

Additional information

I have a local prototype that implements this behavior in codex-rs/tui, including focused tests for:

  • mouse event mapping,
  • partial single-line selection,
  • partial multi-line selection,
  • output/history selection,
  • input composer selection,
  • visible selection highlighting.

Would the Codex team be open to this behavior? If so, I’d be happy to clean up the patch and submit a PR if invited.

Here is my prototype: https://github.com/hamsar4j/codex/tree/feat/select-to-copy

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