fix: proportional column scaling across all tabs when the detail pane opens#37
Merged
Conversation
Signed-off-by: chang-ning <spiderpower02@gmail.com>
Signed-off-by: chang-ning <spiderpower02@gmail.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to make table columns shrink proportionally (by a common fraction of their “natural” widths) when the detail pane reduces available width, keeping the UI consistent across tabs and avoiding abrupt per-column clipping.
Changes:
- Parameterized throughput/gauge bar rendering so bar widths can follow column widths.
- Introduced shared proportional width-scaling helpers and applied them to GPU and RDMA tables.
- Added/updated unit tests for gauge text formatting and column-width scaling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Signed-off-by: chang-ning <spiderpower02@gmail.com>
Signed-off-by: chang-ning <spiderpower02@gmail.com>
Comment on lines
+558
to
+561
| // Block borders (2) and the "▶ " highlight column (2) shrink what the | ||
| // Table layout actually distributes among columns; scale to fit that. | ||
| let avail = area.width.saturating_sub(2 + 2); | ||
| let widths = gpu_col_widths(avail); |
Comment on lines
+2512
to
+2518
| #[test] | ||
| fn gpu_col_widths_wide_returns_natural() { | ||
| assert_eq!( | ||
| gpu_col_widths(200), | ||
| [9, 16, 16, 16, 5, 6, 12, 7, 12, 7, 6, 5] | ||
| ); | ||
| } |
Signed-off-by: chang-ning <spiderpower02@gmail.com>
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.
Purpose
Columns shrink by a common fraction of their natural width
Checklist
cargo fmt --checkpassescargo clippy -- -D warningspassescargo testpasses