Skip to content

Commit

Permalink
Fix padding (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
denisidoro committed Apr 9, 2023
1 parent f641455 commit 4f63f30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/deser/mod.rs
Expand Up @@ -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))
}
}

0 comments on commit 4f63f30

Please sign in to comment.