From 4f63f30ed7b90e33c7c152af1f4e8a58b4c13f41 Mon Sep 17 00:00:00 2001 From: Denis Isidoro Date: Sat, 8 Apr 2023 21:15:55 -0300 Subject: [PATCH] Fix padding (#822) --- src/deser/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/deser/mod.rs b/src/deser/mod.rs index 7b2662e..278687f 100644 --- a/src/deser/mod.rs +++ b/src/deser/mod.rs @@ -34,11 +34,11 @@ fn limit_str(text: &str, length: usize) -> String { let mut new_length = length; let mut actual_length = 9999; let mut txt = text.to_owned(); - while actual_length > length { + while actual_length >= length { txt = txt.chars().take(new_length - 1).collect::(); actual_length = UnicodeWidthStr::width(txt.as_str()); new_length -= 1; } - format!("{}…", txt) + format!("{}…{}", txt, " ".repeat(length - actual_length - 1)) } }