Skip to content

fix(tui): honor client copy shortcut over ssh - #15766

Merged
OutThisLife merged 9 commits into
mainfrom
bb/tui-ssh-copy
Apr 25, 2026
Merged

fix(tui): honor client copy shortcut over ssh#15766
OutThisLife merged 9 commits into
mainfrom
bb/tui-ssh-copy

Conversation

@OutThisLife

@OutThisLife OutThisLife commented Apr 25, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Checked existing open PRs first: feat: support copy command #12362 is a broader stale /copy picker feature and Feat/dashboard chat #13379 is dashboard/xterm copy work; neither directly fixes TUI selection copy shortcuts over SSH.
  • Add a dedicated TUI copy shortcut helper so forwarded Cmd+C (super/legacy meta) copies selections during SSH sessions even when Hermes runs on remote Linux.
  • Preserve local Linux behavior by not treating local Alt+C as copy, and update TUI hotkey hints for remote shells.
  • Track rendered screen cells separately from blank padding so selection can skip UI margins while preserving meaningful spaces, including code-block indentation.
  • Keep successful copy actions silent; usage and “nothing to copy” feedback still appears.

Test plan

  • npm run fix && npm run type-check (in ui-tui)
  • npm run type-check (in ui-tui)
  • npm test -- src/__tests__/platform.test.ts src/__tests__/createSlashHandler.test.ts (in ui-tui)
  • npm test -- packages/hermes-ink/src/ink/selection.test.ts src/__tests__/platform.test.ts (in ui-tui)
  • npm test -- packages/hermes-ink/src/ink/selection.test.ts src/__tests__/platform.test.ts src/__tests__/createSlashHandler.test.ts (in ui-tui)
  • npm test -- src/__tests__/markdown.test.ts packages/hermes-ink/src/ink/selection.test.ts (in ui-tui)
  • npm test -- packages/hermes-ink/src/ink/selection.test.ts src/__tests__/markdown.test.ts src/__tests__/platform.test.ts src/__tests__/createSlashHandler.test.ts (in ui-tui)

- accept forwarded Cmd+C for selection copy in SSH sessions even when Hermes runs on Linux
- keep local Linux Alt+C from acting as copy and update TUI hotkey hints for remote shells

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the TUI’s keybinding logic so selection-copy behaves correctly when running Hermes on a remote machine over SSH, particularly when the client terminal forwards Cmd+C as super (kitty protocol) or legacy meta.

Changes:

  • Add isCopyShortcut() to centralize copy-shortcut detection (including SSH-aware Cmd+C forwarding on non-macOS).
  • Wire isCopyShortcut() into the main input handler path for selection copy behavior.
  • Update hotkey hint text for SSH scenarios and add unit tests for the new helper.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
ui-tui/src/lib/platform.ts Adds SSH-aware isCopyShortcut() (and internal remote-shell detection) to unify copy-chord logic.
ui-tui/src/content/hotkeys.ts Adjusts displayed hotkeys to reflect Cmd+C forwarding over SSH on non-macOS.
ui-tui/src/app/useInputHandlers.ts Uses isCopyShortcut() instead of isAction(..., 'c') for copy handling.
ui-tui/src/tests/platform.test.ts Adds test coverage for isCopyShortcut() across local/SSH scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/src/content/hotkeys.ts Outdated
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/tui Terminal UI (ui-tui/ + tui_gateway/) labels Apr 25, 2026
Reuse the platform helper for SSH-aware copy hints so hotkey display and input handling cannot drift.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- clamp selection highlight to real row content so blank drag margins do not render or copy
- keep successful copy actions quiet while preserving usage and failure feedback
Use an explicit conditional table instead of spread casting for SSH copy hint rows.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/packages/hermes-ink/src/ink/selection.ts Outdated
Comment thread ui-tui/packages/hermes-ink/src/ink/selection.ts Outdated
Comment thread ui-tui/packages/hermes-ink/src/ink/selection.ts Outdated
- trim only empty edge rows instead of full selected text
- bound selection paint using unwritten cells so rendered indentation remains copyable
Render code indentation spaces as selectable cells so copied fenced code keeps its leading whitespace.
- add a written-cell bitmap so selection can distinguish rendered spaces from blank padding
- preserve code indentation without markdown-specific rendering hacks
Keep screen.ts import ordering aligned with the ui-tui formatter.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ui-tui/packages/hermes-ink/src/ink/selection.ts
Clamp copied selection columns to the screen width before scanning rendered cells.
@OutThisLife
OutThisLife merged commit edc78e2 into main Apr 25, 2026
7 of 9 checks passed
@OutThisLife
OutThisLife deleted the bb/tui-ssh-copy branch April 25, 2026 20:33
02356abc pushed a commit to 02356abc/hermes-agent that referenced this pull request May 14, 2026
fix(tui): honor client copy shortcut over ssh
dannyJ848 pushed a commit to dannyJ848/hermes-agent that referenced this pull request May 17, 2026
fix(tui): honor client copy shortcut over ssh
gweeteve pushed a commit to gweeteve/hermes-agent that referenced this pull request Jun 2, 2026
fix(tui): honor client copy shortcut over ssh
waefrebeorn pushed a commit to waefrebeorn/slermes that referenced this pull request Jul 2, 2026
fix(tui): honor client copy shortcut over ssh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P3 Low — cosmetic, nice to have type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants