-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix column width calculation logic in grid #2370
base: main
Are you sure you want to change the base?
fix: Fix column width calculation logic in grid #2370
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2370 +/- ##
==========================================
+ Coverage 46.80% 46.81% +0.01%
==========================================
Files 710 710
Lines 39224 39243 +19
Branches 9789 9796 +7
==========================================
+ Hits 18357 18370 +13
- Misses 20856 20862 +6
Partials 11 11
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
charWidths.set(char, charWidth); | ||
width += charWidth; | ||
if (!charWidths.has(char)) { | ||
context.font = font; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should just set the font at the start of this method... Interesting that we weren't setting the font before this change, I wonder if that caused any issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup missing that initially definitely caused issues and the header text width was not being calculated correctly as a result. Since the header font and cell font only differ slightly, it wasn’t able to be noticed visually. Again, it would be nice to be able to catch something like this through testing.
GridRenderer.binaryTruncateToWidth()
as the measured text width with can differ slightly from the passed in estimated column width. This will prevent cases where text is truncated when it shouldn't be.Stocks table for testing: