0.3.1: fix off-by-1 in TrimStringRef

This commit is contained in:
🪞👃🪞 2025-03-18 01:05:52 +02:00
parent a80443262c
commit b1639b49d5
3 changed files with 7 additions and 7 deletions

View file

@ -35,7 +35,6 @@ impl<T: AsRef<str>> Content<TuiOut> for TrimStringRef<'_, T> {
let mut width: u16 = 0;
let mut chars = self.1.as_ref().chars();
while let Some(c) = chars.next() {
width += c.width().unwrap_or(0) as u16;
if width > self.0 || width > area.w() {
break
}
@ -45,6 +44,7 @@ impl<T: AsRef<str>> Content<TuiOut> for TrimStringRef<'_, T> {
}) {
cell.set_char(c);
}
width += c.width().unwrap_or(0) as u16;
}
}
}