diff options
author | Denis Isidoro <denisidoro@users.noreply.github.com> | 2023-04-08 21:15:55 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-08 21:15:55 -0300 |
commit | 4f63f30ed7b90e33c7c152af1f4e8a58b4c13f41 (patch) | |
tree | 51bf2a7a1519ab960b31566b9882735576177b09 /src | |
parent | f6414551bb94f67e332f7885ac307754e4afdb61 (diff) |
Fix padding (#822)
Diffstat (limited to 'src')
-rw-r--r-- | src/deser/mod.rs | 4 |
1 files 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::<String>(); actual_length = UnicodeWidthStr::width(txt.as_str()); new_length -= 1; } - format!("{}…", txt) + format!("{}…{}", txt, " ".repeat(length - actual_length - 1)) } } |