-
Notifications
You must be signed in to change notification settings - Fork 482
Fix format_number function #1021
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
Conversation
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.
For the sake of comparison, what are each of these tests currently returning with the current code?
Before
After
|
@GladOSkar What do you think? |
When i implemented this i based it off the proposed format from #240, which suggests That said, i don't mind either way. But this could be considered a regression by some. |
One simple solution I see is to count characters, not digits. For example, if I have Edit: no, that's bad idea. (but I'm not sure) |
And maybe make this configurable, because switching between these two behaviors (from this PR and current) is quite easy:
|
Sounds reasonable, although it could be a bit awkward for non-monospaced fonts and also doesn't read as nicely. But that decision is not up to me @ammgws. I'm fine with either. |
Well, with non-monospace fonts the bar will change its size either way. @ammgws, @YodaEmbedding what do you think? |
I will leave it as it is, maybe just refactor it later. |
This does seem like it should be fixed though |
If "430KB" is the expected behavior, then if user wants the bar not to change it's size, he may set |
Yeah that's my thought too. |
.max(min_exp_level) | ||
.min(4); |
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.
By the way, clamp()
is stabilized in rust 1.50.0 which releases soon.
Cheers! |
When I fist read the code I thought that
format_number
should format numbers to engineering notation, but in fact it produces outputs like "0.43MB" instead of "430KB", even if the minimal suffix is set to "K". For me, it doesn't make much sense. Please correct me if the current behavior is intentional.