summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2019-06-08 22:17:57 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2019-06-08 22:17:57 +0200
commit463d0988dd0738c6a4760128823e03a37d967513 (patch)
treefc0067dd5a716771c8652de2cf15975f4fe52b86
parentabbbde87e28982150d30e748b89c5303384909ca (diff)
Make humanized size rounding clearer by padding decimals with zeroes
For example, "5 MB" will now be displayed as "5.00 MB" to make the rounding precision clear, regardless of the value being rounded. This closes #29611.
-rw-r--r--core/ustring.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/ustring.cpp b/core/ustring.cpp
index 88b758e883..dbd21391fa 100644
--- a/core/ustring.cpp
+++ b/core/ustring.cpp
@@ -3246,7 +3246,7 @@ String String::humanize_size(size_t p_size) {
int digits = prefix_idx > 0 ? _humanize_digits(p_size / _div) : 0;
double divisor = prefix_idx > 0 ? _div : 1;
- return String::num(p_size / divisor, digits) + prefix[prefix_idx];
+ return String::num(p_size / divisor).pad_decimals(digits) + prefix[prefix_idx];
}
bool String::is_abs_path() const {