Skip to content

Keep terminal Copy enabled so Cmd+C works on agent TUI panes - #14557

Merged
teamleaderleo merged 1 commit into
mainfrom
salvage/8064-cmd-c-agent-tui
Sep 25, 2026
Merged

teamleaderleo merged 1 commit into
mainfrom
salvage/8064-cmd-c-agent-tui

Conversation

@teamleaderleo

@teamleaderleo teamleaderleo commented Sep 25, 2026 •

Copy link
Copy Markdown
Collaborator

Salvaged from #8064 by @a05031113. That PR no longer merges cleanly, so this lands the one piece that is still broken on main.

Problem

On agent TUI panes (Claude Code, Codex, etc.) Edit > Copy can be greyed out while text is visibly selected, and Cmd+C does nothing. validateUserInterfaceItem gated Copy on ghostty_surface_has_selection, which can report false while the runtime still holds a live selection under constant TUI redraw. A disabled Copy item means the menu misses, and since #8895 that miss is consumed as a no-op, so the copy never happens.

Fix

Enable Copy whenever the view has a surface. copy(_:) already runs the configured copy binding and falls back to the selection snapshot, so copying with no selection is still a no-op and never reaches the PTY.

The right-click context menu still shows Copy only when there is a selection; that is unchanged.

Not ported from #8064

The other two fixes in #8064 (empty clipboard writes clearing the pasteboard, and the VT-export capture race) were superseded by the TerminalPasteboardService rewrite in #8838, so they are left out here.

Tradeoff to review

A user with a performable:cmd+c=copy_to_clipboard binding previously had Cmd+C fall through to the terminal when nothing was selected. With Copy always enabled, the menu now handles Cmd+C and it does not fall through. This is rare but deliberate; flag it if we want to keep that path.

Testing

No focused unit test: #8064 had none for this piece and it depends on live runtime selection state. Needs CI compile plus a manual check: select text in a busy agent pane, Cmd+C, paste.

Co-authored with @a05031113 (credited in the commit trailer).

🤖 Generated with Claude Code


Summary by cubic

Fixes Cmd+C not copying on agent TUI panes (Claude Code, Codex, etc.) when text is visibly selected but Copy is greyed out. ghostty_surface_has_selection can report false under constant TUI redraw, and a disabled Copy menu item swallows Cmd+C before the runtime's copy binding handles it. Copy is now enabled whenever a surface exists; copying with no selection is still a no-op, and the right-click menu still only shows Copy when there is a selection.

Tradeoff to review

  • Users with a performable:cmd+c=copy_to_clipboard binding previously had Cmd+C fall through to the terminal when nothing was selected; it now hits the menu as a no-op instead.

Written for commit 60ba574. Summary will update on new commits.

Review in cubic

ghostty_surface_has_selection can report false while the runtime still
holds a live selection, for example under constant TUI redraw in agent
panes. Gating the Copy menu item on it greyed Copy out and swallowed
Cmd+C. Enable Copy whenever a surface exists; copying with no selection
is a no-op.

Salvaged from #8064.

Co-Authored-By: a05031113 <a05031113@gmail.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 25, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 10 included reviews currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository: manaflow-ai/cmux/.coderabbit.yaml

Review profile: ASSERTIVE

Plan: Advanced

Run ID: fadf9677-93fd-4c6f-89b8-266cf090493d

📥 Commits

Reviewing files that changed from the base of the PR and between f2550c9 and 60ba574.

📒 Files selected for processing (1)
  • Sources/GhosttyTerminalView.swift

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@teamleaderleo
teamleaderleo merged commit 2e9c051 into main Sep 25, 2026
48 checks passed
@teamleaderleo
teamleaderleo deleted the salvage/8064-cmd-c-agent-tui branch September 25, 2026 11:44
@github-actions

Copy link
Copy Markdown
Contributor

Merge receipt for 60ba574271, merged 2026-09-25 11:44:45 UTC

  • Not verified at merge: ci-status (not reported), macOS compile admission (in progress)
  • Verified: Web complexity, web-validation, Fast static checks, GhosttyKit release check, guards (17), linux-preflight, macOS admission gate, Testbox broker trust boundary
  • Skipped by policy: browser, Claude wrapper regressions, remote-daemon, suite-coverage, swift-package-tests, web, web-build, web-database-tests, web-tests
  • Full suite: runs on main after merge.

Labeled merged-unverified: if main breaks near this merge, look here first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-unverified A judging check was not green at merge; see the merge receipt comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant