mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2025-12-06 19:56:44 +01:00
0.3.1: fix off-by-1 in TrimStringRef
This commit is contained in:
parent
a80443262c
commit
b1639b49d5
3 changed files with 7 additions and 7 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue