Skip to content

feat(web): add copy path button to diff headers - #2403

Merged
maria-rcks merged 42 commits into
pingdotgg:mainfrom
ipanasenko:t3code/853b397b
Sep 2, 2026
Merged

feat(web): add copy path button to diff headers#2403
maria-rcks merged 42 commits into
pingdotgg:mainfrom
ipanasenko:t3code/853b397b

Conversation

@ipanasenko

@ipanasenko ipanasenko commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Hey guys!

I find myself in a need to copy a file path from diff view quite often. I use it to paste into the chat and ask questions about this specific file. I think it makes it much more obvious for model (and for me) what file we are talking about.

Currently the best workflow in T3 Code I found for copying file path is to manually select file path and do Cmd+C. I think this can be improved by adding a copy button, GitHub-style.

image image

Summary

  • add a copy-path button to diff file headers using the Diffs renderHeaderFilenameSuffix slot

Note

Add copy path button to diff headers

  • Adds a DiffFilePathCopyButton control to each diff file header via a new required filename-suffix renderer prop in AnnotatableCodeView.tsx.
  • DiffPanel.tsx resolves the displayed path for each file diff and supplies it to the copy button.
  • Extracts shared one-second timeout and anchored toast logic into anchoredCopyToast.ts and refactors the existing MessageCopyButton to use it.
  • Risk: AnnotatableCodeView now requires a filename-suffix renderer prop; existing callers must pass it or rendering will fail.

Macroscope summarized ce84909.


Note

Low Risk
UI-only clipboard affordance and a small shared toast helper refactor with no auth, data, or API impact.

Overview
Adds a copy path control next to each file name in the diff view so users can paste the full path into chat without manual selection.

DiffFilePathCopyButton copies the resolved path via useCopyToClipboard and shows anchored success/error toasts. DiffPanel mounts it through a new renderHeaderFilenameSuffix callback on AnnotatableCodeView, which forwards that slot to the underlying diff header renderer for diff items only.

Anchored copy toast logic is extracted from MessageCopyButton into anchoredCopyToast.ts so message and diff copy buttons share the same behavior. renderHeaderFilenameSuffix is now required on AnnotatableCodeView (call sites pass the copy button or () => null in tests).

Reviewed by Cursor Bugbot for commit ce84909. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Apr 29, 2026
@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 600de21e-78e3-4b13-a772-530211a934db

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

@ipanasenko ipanasenko changed the title Add copy path button to diff headers feat: add copy path button to diff headers Apr 29, 2026
@ipanasenko
ipanasenko marked this pull request as ready for review April 29, 2026 12:03
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Not approved

Macroscope's review found this PR not approvable — This PR adds an always-visible copy-path control to production diff headers and introduces new clipboard interaction behavior through a new component. The implementation is localized and reuses existing infrastructure, but the new user-facing capability warrants human review.

You can add or adjust custom eligibility rules. Learn more.

@github-actions github-actions Bot added size:L 100-499 changed lines (additions + deletions). and removed size:M 30-99 changed lines (additions + deletions). labels Apr 29, 2026
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 18, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review June 18, 2026 16:03

Dismissing prior approval to re-evaluate b028ddf

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jun 18, 2026
@juliusmarminge

Copy link
Copy Markdown
Member

I'd left align them after the path, like Github:

CleanShot 2026-06-18 at 20 41 37@2x

@ipanasenko

Copy link
Copy Markdown
Contributor Author

From what I see, to achieve this we'd need to use renderCustomHeader prop, and construct whole header manually. Are you okay with that?
Or am I missing something in diffs docs? 👀

@macroscopeapp
macroscopeapp Bot dismissed their stale review June 21, 2026 18:27

Dismissing prior approval to re-evaluate a29ebac

Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 14, 2026 14:15

Dismissing prior approval to re-evaluate 6f44eec

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 14, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 15, 2026 12:40

Dismissing prior approval to re-evaluate e3c290e

@macroscopeapp macroscopeapp Bot 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.

Two consistency issues around the new diff-header icon button. Both come from reconstructing the Button primitive as a raw class string instead of using the existing icon-micro / ghost contract.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/DiffPanel.tsx Outdated
Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
Comment thread apps/web/src/components/diffs/diffHeaderControls.ts Outdated
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 15, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 15, 2026 13:43

Dismissing prior approval to re-evaluate 36cfa99

macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Aug 15, 2026
@ipanasenko ipanasenko changed the title feat: add copy path button to diff headers feat(web): add copy path button to diff headers Aug 15, 2026
@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. and removed vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Sep 2, 2026
@macroscopeapp
macroscopeapp Bot dismissed their stale review September 2, 2026 20:01

Dismissing prior approval to re-evaluate 56930d4

@cursor cursor Bot 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.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 56930d4. Configure here.

Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated

@macroscopeapp macroscopeapp Bot 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.

One finding on the latest commit (56930d4, "remove copy path button background"): the background suppression is expressed as an unconditional !important call-site override of the ghost variant instead of the repo's variant-scoped idiom. Everything flagged in the previous run (raw <button>, DIFF_HEADER_ICON_BUTTON_CLASS_NAME) is resolved.

Posted via Macroscope — UI Consistency

Comment thread apps/web/src/components/DiffFilePathCopyButton.tsx Outdated
@maria-rcks
maria-rcks merged commit b57726c into pingdotgg:main Sep 2, 2026
27 checks passed
sheehanmunim added a commit to munimtechnologies/mtcode that referenced this pull request Sep 2, 2026
…continuation, provider editor redesign, context meter opt-in, linked-PR summaries)

Brings the fork up to origin/main e0da6c6..b57726c. Highlights: continue
active threads across server self-updates (pingdotgg#9167), provider editor and models
list redesign (pingdotgg#8508), opt-in context window meter (pingdotgg#9190), linked-PR summary
RPC with last-good caching (pingdotgg#9176), relay credential refresh before expiry
(pingdotgg#9178), composer draft preserved through worktree setup (pingdotgg#9197), project
skill discovery for Claude (pingdotgg#9210), copy-path on diff headers (pingdotgg#2403), mobile
long-press file references (pingdotgg#9258).

Conflict resolutions (14 files), keep-both unless noted:
- RpcAuthorization / contracts rpc / ws.ts: fork's PR rank, cherry-pick and
  upstream-release RPCs sit beside upstream's new pullRequestsSummary.
- ws.ts route layer: fork's computer task/view brokers plus upstream's
  serverSelfUpdate wrapped in withRunningThreadContinuation.
- PullRequestService: fork's upstream-project reads and scoped diff epochs
  kept; upstream's summary read, refCacheKey and viewer-flight invalidation
  added. invalidate() now scopes diff-only invalidation AND clears viewer
  flights on a whole-workspace refresh. Test file keeps both new suites.
- client-runtime pullRequests: fork's PR stack atoms kept, TTL constant
  takes upstream's new name.
- ChatMarkdown: upstream's one-character gutter rule replaces the fork's
  equivalent digitWidth fix.
- ChatComposer: fork's voice-session button kept; context meter now honours
  settings.contextWindowMeterEnabled.
- ConnectionsSettings: fork's EnvironmentLabelControl kept with upstream's
  min-w-0 truncate.
- mobile ThreadFeed: upstream's markdownLinkHandlers plus the fork's
  onCancelQueuedMessage.
- ClaudeDriver imports: fork's superset. build-desktop-artifact: distro and
  arch both threaded through.

Integration: upstream's restart continuation and the fork's resume-on-restart
both ran at boot on the same orphans. The continuation-marker helpers move to
provider/serverUpdateContinuation.ts and SessionStartupReconciler now defers
any binding carrying the marker to upstream's pass (logged as deferred), so a
thread is never continued twice. Test added.

Dependencies reinstalled for the expo-sharing pin; the stale pnpm copy of
@t3tools/mobile-markdown-text was what broke the mobile typecheck.

Typecheck clean: contracts, shared, client-runtime, server, web, mobile
(desktop exits 1 on a pre-existing warning-level diagnostic). Startup and
self-update suites 36 passing; web sidebar/composer/settings suites 419
passing; fork guard script OK.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
github-actions Bot added a commit to omarcresp/t3code-flake that referenced this pull request Sep 2, 2026
## What's Changed
* fix(web): hide deleted providers with prototype keys by @Lucenx9 in pingdotgg/t3code#8337
* feat(mobile): long-press file references for path and open actions by @juliusmarminge in pingdotgg/t3code#9258
* fix(desktop): exclude opposite macOS pty prebuilds by @extoci in pingdotgg/t3code#9240
* feat(web): add copy path button to diff headers by @ipanasenko in pingdotgg/t3code#2403
* fix(server): subscribe before provider settings watcher by @t3-code[bot] in pingdotgg/t3code#9271
* fix(mobile): show filled filter icon on Android when filters are active by @none23 in pingdotgg/t3code#9217
* fix(chat): show single tool calls without summaries by @maria-rcks in pingdotgg/t3code#9267
* fix(web): warn when shared settings have no target environment by @imabdulazeez in pingdotgg/t3code#9207
* fix(web): confirm closing agent-controlled browsers by @maria-rcks in pingdotgg/t3code#9272


**Full Changelog**: pingdotgg/t3code@v0.0.39-nightly.20260902.1260...v0.0.39-nightly.20260902.1261

Upstream release: https://github.com/pingdotgg/t3code/releases/tag/v0.0.39-nightly.20260902.1261
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants