From 463d0988dd0738c6a4760128823e03a37d967513 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Sat, 8 Jun 2019 22:17:57 +0200 Subject: [PATCH] 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. --- core/ustring.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/ustring.cpp b/core/ustring.cpp index 88b758e8835..dbd21391fad 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 {