Trim file paths in the discard dialog, and cut trimmed paths flush by measurement - #84
Merged
Conversation
…ipsis CSS text-overflow drops the whole partially-clipped character and draws the ellipsis where the last full one ended, leaving a ragged, row-varying gap between the dimmed directory and the file name. The new TrimmedPath primitive measures the text (canvas measureText, binary-searched in pathTrim.ts) and cuts the directory string itself, so the name always sits directly after the ellipsis. Adopted by the changes-list rows (WorkingFileList, also serving History/Graph/stash lists) and the discard dialog's file list.
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.
What
Two path-display fixes, one visible in the discard confirmation and one across every file list:
Discard dialog file names were invisible. The confirmation list showed full paths clipped from the right, so deep trees rendered every row as
Modules/AssetBundle/Tests/UTFTests/AssetBundles/R…. Rows now use the same dir/name trimming as the pending-changes list: the directory gives way, the file name always stays visible.The ragged gap between the trimmed directory and the file name is gone. CSS
text-overflow: ellipsisdrops the whole partially-clipped character and draws…where the last full one ended, leaving a row-varying blank between the dimmed directory and the name. The newTrimmedPathprimitive measures the text instead (canvasmeasureText, binary search inpathTrim.ts) and cuts the directory string itself, so the name sits flush after the ellipsis in every row.How
pathTrim.ts— pure cut logic (measurer injected, bisects over code points so surrogate pairs never split), unit-tested including a linear-search cross-check.TrimmedPath.tsx— dim dir + strong name spans; fits before paint on mount/path change and re-fits viaResizeObserver; drops the tooltip layer'sdata-tip-overflowgate while trimmed (nothing CSS-clips once the text is cut to size, so the gate would suppress the full-path tip).WorkingFileListrows (Changes, History, Graph and stash lists) and the discard dialog list;.tpathlives inprimitives.cssper the reuse rule.Diff/conflict headers keep plain CSS ellipsis: their containers' widths are content-dependent, so measured trimming there needs its own layout rework (and the artifact is a single line, at most one character wide).
Verification
lint,typecheck,testgreen (832 tests).🤖 Generated with Claude Code