From b1639b49d508fa9f124b9d81782f0e4318a8f847 Mon Sep 17 00:00:00 2001 From: unspeaker Date: Tue, 18 Mar 2025 01:05:52 +0200 Subject: [PATCH] 0.3.1: fix off-by-1 in TrimStringRef --- Cargo.lock | 10 +++++----- Cargo.toml | 2 +- tui/src/tui_content/tui_string.rs | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 39af87d..2804e1b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -934,7 +934,7 @@ dependencies = [ [[package]] name = "tengri" -version = "0.3.0" +version = "0.3.1" dependencies = [ "tengri_dsl", "tengri_input", @@ -944,7 +944,7 @@ dependencies = [ [[package]] name = "tengri_dsl" -version = "0.3.0" +version = "0.3.1" dependencies = [ "itertools 0.14.0", "konst", @@ -955,7 +955,7 @@ dependencies = [ [[package]] name = "tengri_input" -version = "0.3.0" +version = "0.3.1" dependencies = [ "tengri_dsl", "tengri_tui", @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "tengri_output" -version = "0.3.0" +version = "0.3.1" dependencies = [ "proptest", "proptest-derive", @@ -974,7 +974,7 @@ dependencies = [ [[package]] name = "tengri_tui" -version = "0.3.0" +version = "0.3.1" dependencies = [ "atomic_float", "better-panic", diff --git a/Cargo.toml b/Cargo.toml index 02a20f2..b7073ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [workspace.package] -version = "0.3.0" +version = "0.3.1" [workspace] resolver = "2" diff --git a/tui/src/tui_content/tui_string.rs b/tui/src/tui_content/tui_string.rs index ab43b43..45b6d2d 100644 --- a/tui/src/tui_content/tui_string.rs +++ b/tui/src/tui_content/tui_string.rs @@ -35,7 +35,6 @@ impl> Content 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> Content for TrimStringRef<'_, T> { }) { cell.set_char(c); } + width += c.width().unwrap_or(0) as u16; } } }