Skip to content

Cannot copy text from TUI with Cmd+C #91

@sambostock

Description

@sambostock

ralph-tui version

0.1.7

Bun version

1.2.7

Platform

macOS (Apple Silicon)

Steps to reproduce

Steps to reproduce:

  1. Run ralph-tui or ralph-tui create-prd --chat
  2. Select text with the mouse (text highlights correctly)
  3. Press Cmd+C to copy
  4. Try to paste elsewhere

Expected: Selected text is copied to clipboard
Actual: Nothing is copied to clipboard

Relevant logs / terminal output

No error output - the copy operation silently fails.
Copying works fine in other terminal applications and outside the TUI.

Additional context

OpenTUI defaults to useMouse: true, which enables terminal mouse tracking mode. When mouse tracking is enabled, the terminal delegates selection handling to the TUI instead of handling it natively.

The TUI correctly tracks selection (text highlights when selected), but when Cmd+C is pressed, the terminal's native copy doesn't work because the terminal didn't perform the selection—OpenTUI did.

Potential fixes:

  1. Simple: Set useMouse: false in renderer config to let terminal handle selection natively (may affect scroll wheel)
  2. Complete: Implement clipboard integration by handling Cmd+C to call renderer.selection?.getSelectedText() and piping to platform clipboard (pbcopy/xclip/clip)

Relevant code location: src/commands/run.tsx:740-742 where renderer is created.

If it's relevant, I'm using Ghostty

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions