fix(tui): fit project paths in open menu - #39887
Merged
Merged
Conversation
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
Fit project paths within Open-menu rows without clipping the end of the already-truncated path, while using the full width of the large dialog on wider terminals.
This follows up on #39678. The path helper was given a width that did not match
DialogSelectrow geometry, and the original follow-up calculation still assumed a 60-column dialog although Open uses the 88-column large size.Before / After
Before
A constrained 60-column row budgeted three columns more than it could display, so the path's final characters were clipped after truncation. On wider terminals, Open still capped the calculation at 60 columns and unnecessarily discarded up to 28 columns of its large dialog.
After
Dialog sizes and selectable-row content width have shared policies. Open calculates against its actual large-dialog width, constrained by the terminal, and
truncateFilePathreceives the exact remaining content width.How
packages/tui/src/ui/dialog.tsxowns medium, large, and xlarge dialog widths.packages/tui/src/ui/dialog-select.tsxowns the selectable-row content width.packages/tui/src/component/dialog-open.tsxderives path width from the large dialog and row content policies.packages/tui/src/component/dialog-move-session.tsxreuses the same row policy for its xlarge dialog.packages/tui/test/cli/tui/dialog-select.test.tsxcovers constrained and full-width budgets and renders a truncated footer to verify its complete tail remains visible.Scope
This does not change the path truncation algorithm or general dialog size values.
Testing
cd packages/tui && bun run test(577 passed, 5 skipped)cd packages/tui && bun typecheckbun turbo typecheck --concurrency=3(33 tasks passed)