Skip to content

feat: add pane hover copy-location control - #3145

Closed
aneym wants to merge 3 commits into
herdrdev:masterfrom
aneym:upstream-pane-copy-location
Closed

feat: add pane hover copy-location control#3145
aneym wants to merge 3 commits into
herdrdev:masterfrom
aneym:upstream-pane-copy-location

Conversation

@aneym

@aneym aneym commented Aug 23, 2026

Copy link
Copy Markdown
Contributor

Summary

Hovering a pane shows a small control at the top right of its border. Clicking it copies the pane's public id (for example w2:p5, the same target string herdr agent read and the rest of the CLI/API accept) to the clipboard and shows a copied w2:p5 toast. Typing a pane target today means reading it out of the UI by hand; this makes it one click.

Behavior details:

  • The control renders only for the hovered pane, on panes with a top border at least 8 cells wide, and never for popup panes.
  • The click is fully consumed: no focus change, no forwarding to the pane app, no drag or selection start.
  • Works in both mouse modes (captured and mouse_capture = false forwarding) and in both the monolithic and headless server paths.
  • Hover state lives in the TUI client only. No protocol, API schema, or config changes, and no new dependencies.
  • Mouse motion stays render-neutral unless the hovered target actually changes, so repeated motion does not add redraws; hover is cleared on workspace/tab switches, mode changes, popup open, and pane close.

Test plan

  • Regression tests cover span geometry, hover set/clear and change-only redraws, click consumption (focus, drag, forwarding), the copied id and toast message, both mouse modes, stale hover across workspace switches, and dropped-clipboard feedback in headless mode.
  • cargo fmt --check, cargo clippy --all-targets --locked -- -D warnings: clean.
  • Full cargo nextest run --no-fail-fast: 3356 passed; the only 3 failures are environment-specific on this machine (two live_handoff, one api_ping done-status) and fail identically on unpatched master.
  • Maintenance suite 98/98, ui-hot-path architecture tests 6/6.

Generated with Claude Code

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 23, 2026
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8005aebd-d41b-4b42-9372-aaea29f8d4ef

📥 Commits

Reviewing files that changed from the base of the PR and between d6dae88 and 5152b77.

📒 Files selected for processing (15)
  • src/app/actions.rs
  • src/app/api.rs
  • src/app/input/clipboard.rs
  • src/app/input/copy_mode.rs
  • src/app/input/mod.rs
  • src/app/input/mouse.rs
  • src/app/input/terminal.rs
  • src/app/mod.rs
  • src/app/runtime.rs
  • src/app/state.rs
  • src/events.rs
  • src/pane.rs
  • src/server/headless.rs
  • src/ui.rs
  • src/ui/panes.rs
🚧 Files skipped from review as they are similar to previous changes (15)
  • src/app/input/copy_mode.rs
  • src/app/mod.rs
  • src/pane.rs
  • src/app/input/clipboard.rs
  • src/app/input/terminal.rs
  • src/app/runtime.rs
  • src/events.rs
  • src/ui.rs
  • src/app/api.rs
  • src/ui/panes.rs
  • src/app/state.rs
  • src/app/input/mouse.rs
  • src/app/input/mod.rs
  • src/server/headless.rs
  • src/app/actions.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 7 remain after this review.


📝 Walkthrough

Walkthrough

The change adds pane copy controls with hover tracking, copies pane identifiers on click, and carries custom clipboard feedback through clipboard events and delivery.

Changes

Pane copy control and clipboard feedback

Layer / File(s) Summary
Clipboard event and state lifecycle
src/events.rs, src/app/state.rs, src/app/input/clipboard.rs, src/app/api.rs, src/app/actions.rs, src/pane.rs, src/server/headless.rs, src/app/input/copy_mode.rs, src/app/input/terminal.rs, src/app/mod.rs
Clipboard writes now carry optional feedback. Delivery shows custom feedback or "copied to clipboard" when foreground delivery succeeds. Existing clipboard paths and tests provide feedback: None.
Copy-control geometry and rendering
src/ui/panes.rs, src/ui.rs
The UI computes copy-button spans for eligible panes, renders the control for hovered terminal panes, and clears stale hover state.
Copy-control mouse handling
src/app/input/mouse.rs, src/app/input/mod.rs
Mouse handling detects copy-button presses, queues the pane public identifier with feedback, and consumes source-specific drag and release events without changing normal pane gestures.
Hover-driven input and render propagation
src/app/state.rs, src/app/mod.rs, src/app/runtime.rs, src/server/headless.rs, src/app/input/mouse.rs
Application state tracks pane hover and copy-button press sources. Pane-only handling dispatches pending clipboard writes. Hover changes request rendering. Tests cover source cleanup and motion behavior.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Merge Risk: ⚪ Minimal · up to 5152b

This change adds a localized hover control for copying pane identifiers and showing feedback, with no actionable merge-blocking risk remaining after normal checks and review.

Sequence Diagram(s)

sequenceDiagram
  participant Pointer
  participant MouseHandling
  participant AppState
  participant ClipboardQueue
  participant ForegroundClient
  Pointer->>MouseHandling: Hover or click pane copy control
  MouseHandling->>AppState: Update pane_hover and copy-button press state
  MouseHandling->>ClipboardQueue: Queue pane identifier and feedback
  ClipboardQueue->>ForegroundClient: Deliver ClipboardWrite event
  ForegroundClient-->>AppState: Show custom or default clipboard feedback
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding a pane hover copy-location control.
Description check ✅ Passed The description directly explains the pane hover copy control, clipboard behavior, supported modes, state handling, and tests.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/app/state.rs (1)

1470-1470: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add doc comments for the new state fields.

request_clipboard_write has a doc comment, but request_clipboard_feedback does not. pane_hover uses an anonymous tuple (PaneId, bool) with no comment to explain the bool. A short comment on each field (for example, "message queued for the next successful clipboard delivery" and "hovered pane id and whether the copy button itself is hovered") would help future readers avoid re-deriving the meaning from call sites.

Also applies to: 1500-1500

src/server/headless.rs (1)

2331-2339: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Add a positive-path test for custom clipboard feedback delivery.

Existing tests cover the default message, the no-foreground-client case, the failed-send case, and the dropped-then-default case. None of them set request_clipboard_feedback to a custom message and then verify that message (not the "copied to clipboard" fallback) reaches copy_feedback after a successful foreground delivery. Add a test that sets a custom message, connects a working foreground client, sends AppEvent::ClipboardWrite, and asserts copy_feedback.message equals the custom message.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 9fca056b-8e83-4cb7-b222-c869ae72fb7d

📥 Commits

Reviewing files that changed from the base of the PR and between d6dae88 and 5438e2c.

📒 Files selected for processing (11)
  • src/app/actions.rs
  • src/app/api.rs
  • src/app/input/clipboard.rs
  • src/app/input/mod.rs
  • src/app/input/mouse.rs
  • src/app/mod.rs
  • src/app/runtime.rs
  • src/app/state.rs
  • src/server/headless.rs
  • src/ui.rs
  • src/ui/panes.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread src/app/input/mod.rs
@greptile-apps

greptile-apps Bot commented Aug 23, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds a hover-activated pane control that copies the pane’s public location while consuming the corresponding mouse interaction. It also completes the prior clipboard-feedback fix by carrying feedback alongside clipboard content through asynchronous delivery.

  • Adds pane hover state, copy-control rendering, and hit testing.
  • Supports captured and uncaptured mouse-routing paths.
  • Associates each clipboard event with its own feedback message.
  • Forwards clipboard writes and feedback through monolithic and headless runtimes.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
src/app/input/mouse.rs Adds pane-copy hit testing, hover tracking, press consumption, and public-ID clipboard requests.
src/app/input/clipboard.rs Dispatches clipboard content and optional feedback together in one event, resolving the previously reported association issue.
src/events.rs Extends the internal clipboard event with event-local feedback.
src/app/api.rs Consumes clipboard feedback directly from the corresponding event in the monolithic path.
src/server/headless.rs Preserves event-associated feedback while forwarding clipboard content to the foreground client.
src/ui/panes.rs Renders the copy-location control for the eligible hovered pane.

Sequence Diagram

sequenceDiagram
    participant U as User
    participant I as Mouse input
    participant S as AppState
    participant E as Clipboard event queue
    participant H as Host or foreground client
    U->>I: Click pane copy control
    I->>S: Resolve pane public ID
    S->>E: ClipboardWrite(content, feedback)
    E->>H: Deliver clipboard content
    E->>S: Show event-associated feedback
    S-->>U: copied wN:pN
Loading

Reviews (2): Last reviewed commit: "fix: dispatch uncaptured copy clicks and..." | Re-trigger Greptile

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/app/state.rs (1)

2040-2117: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider validating pane_hover and pane_copy_presses in assert_invariants_for_test.

assert_invariants_for_test validates that other transient UI state (selection, drag, context_menu, right_click_passthrough) references only live panes. It does not do the same for the new pane_hover field. If a future change fails to clear pane_hover on pane closure, this invariant check would not catch a dangling pane reference in tests.

Add a check that, when pane_hover is Some((pane_id, _)), pane_id is a live pane, following the same pattern as the other assert_live_pane calls.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4a12db0d-31dd-42e4-a004-8a6796877561

📥 Commits

Reviewing files that changed from the base of the PR and between 5438e2c and 3358288.

📒 Files selected for processing (6)
  • src/app/input/mod.rs
  • src/app/input/mouse.rs
  • src/app/mod.rs
  • src/app/runtime.rs
  • src/app/state.rs
  • src/server/headless.rs

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Comment thread src/app/runtime.rs
Comment thread src/app/input/mouse.rs Outdated
@aneym
aneym force-pushed the upstream-pane-copy-location branch from 0250200 to 5152b77 Compare August 23, 2026 07:22
@ogulcancelik

Copy link
Copy Markdown
Collaborator

please dont open pull requests for features that are not given a green light from maintainers.

@kangal-bot kangal-bot removed the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 23, 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.

3 participants