summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-07-10 09:06:17 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-07-10 09:07:25 +0800
commit97022961a0d7f65c605f71f764b766b29866c4c7 (patch)
tree783be4189fc7671333e78621572ebf6312d6afb5
parent69edd7c1b109a443565c6fd9d2e23d2e030031dd (diff)
Calculate block width without going through graphemes
This seems faster, yielding the same results. At least it doesn't break anything.
-rw-r--r--tui-react/src/lib.rs2
1 files changed, 1 insertions, 1 deletions
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::<usize>() as u16
+ d.width() as u16
}
pub mod rect {