From 97022961a0d7f65c605f71f764b766b29866c4c7 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Fri, 10 Jul 2020 09:06:17 +0800 Subject: Calculate block width without going through graphemes This seems faster, yielding the same results. At least it doesn't break anything. --- tui-react/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tui-react/src/lib.rs b/tui-react/src/lib.rs index d66663d..e841d3b 100644 --- a/tui-react/src/lib.rs +++ b/tui-react/src/lib.rs @@ -113,7 +113,7 @@ pub mod util { } pub fn block_width(s: &str) -> u16 { - s.graphemes(true).map(|g| g.width()).sum::() as u16 + d.width() as u16 } pub mod rect { -- cgit v1.2.3