Skip to content

feat: drag-select and copy text from main pane terminal - #49

Closed
sebasv wants to merge 1 commit into
mainfrom
copy-paste-polish
Closed

feat: drag-select and copy text from main pane terminal#49
sebasv wants to merge 1 commit into
mainfrom
copy-paste-polish

Conversation

@sebasv

@sebasv sebasv commented May 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds in-app text selection for the embedded terminal: drag in the main pane to highlight a region, mouse-up auto-copies via OSC 52. Replaces the OS-level Shift+drag escape hatch (which spans the sidebar).
  • Detects host clipboard support at startup from `TMUX`, `TERM_PROGRAM`, `TERM`, and emulator-specific env vars. On the first uncertain copy, surfaces a one-time hint in the sidebar with a specific remediation (tmux `set-clipboard on`, unsupported emulator name, etc.).
  • Selection is cleared on tab switch, scroll, mode toggle, view change, or any keystroke that reaches the PTY, so the highlight never references stale rows.

Test plan

  • Drag-select inside the main pane → highlight appears, mouse-up copies text reachable via Cmd+V in another window.
  • Drag past the pane edges → selection clamps to the pane.
  • Pure click (no drag) → no highlight, no copy.
  • Click in sidebar / tab bar after selecting → selection clears.
  • Scroll wheel after selecting → selection clears, scroll proceeds normally.
  • Type into the shell after selecting → selection clears, keystrokes reach PTY.
  • Run inside tmux → first copy shows `⚠ clipboard: copy may not work / tmux: needs `set -g set-clipboard on` for OSC 52`.
  • Run in macOS Terminal.app → first copy shows the macOS-specific hint.
  • Run in iTerm2/Kitty/WezTerm/Alacritty/Ghostty → no clipboard warning.

🤖 Generated with Claude Code

Restores in-app text selection inside the embedded terminal so users
don't have to reach for the OS-level Shift+drag escape hatch (which
spans the sidebar). Mouse drag in the main pane paints a reversed
highlight; on mouse-up grove reads the selection from the vt100 screen
and pushes it to the system clipboard via OSC 52.

Because OSC 52 support varies, grove now sniffs the host emulator from
TMUX/TERM_PROGRAM/TERM and emulator-specific env vars at startup. On
the first uncertain copy a one-time hint surfaces in the sidebar with
a specific remediation (tmux config, unsupported emulator, etc.) so
users aren't left wondering why a paste elsewhere comes up empty.

Co-Authored-By: Claude <noreply@anthropic.com>
@sebasv sebasv closed this May 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant