feat: middle-truncate long file paths in diff panel#1603
Open
reverb256 wants to merge 2 commits intoPostHog:mainfrom
Open
feat: middle-truncate long file paths in diff panel#1603reverb256 wants to merge 2 commits intoPostHog:mainfrom
reverb256 wants to merge 2 commits intoPostHog:mainfrom
Conversation
Uses @chenglou/pretext to measure file path width and middle-truncate when it overflows. Truncation always breaks between slashes (e.g. src/.../ActionSelector.tsx). - Shows full path when it fits - Middle-truncates with '...' between slashes when too long - Tooltip with full path appears on hover, only when truncated - Falls back to '.../filename' if nothing else fits Fixes PostHog#1600
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Problem
File paths in the diff/edit tool view wrap poorly when too long, as described in #1600.
Fixes #1600
Solution
Uses
@chenglou/pretextto measure text width and middle-truncate when the path overflows:src/renderer/components/action-selector/ActionSelector.tsxsrc/.../action-selector/ActionSelector.tsx.../ActionSelector.tsxTruncation always breaks between
/segments — never mid-directory-name.Files Changed
FileMentionChip.tsx— addedmiddleTruncatePathwith pretext measurement + conditionalTooltippackage.json/pnpm-lock.yaml— added@chenglou/pretextdependency