From 8614a7a398f39d5151a8b837cb7c0cd4d681ff4c Mon Sep 17 00:00:00 2001 From: Andrew Wheeler Date: Thu, 29 Dec 2022 10:25:01 -0500 Subject: [PATCH] Updated RangeMap to Add Clear(). --- Cargo.toml | 2 +- examples/rich-text/src/main.rs | 3 +++ src/attrs.rs | 3 +-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9862c35..fdadee3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,7 +20,7 @@ sys-locale = { version = "0.2.3", optional = true } unicode-linebreak = "0.1.4" unicode-script = "0.5.5" unicode-segmentation = "1.10.0" -rangemap = "1.1.0" +rangemap = "1.2.0" [dependencies.unicode-bidi] version = "0.3.8" diff --git a/examples/rich-text/src/main.rs b/examples/rich-text/src/main.rs index 75854e8..0d753c8 100644 --- a/examples/rich-text/src/main.rs +++ b/examples/rich-text/src/main.rs @@ -121,6 +121,9 @@ fn main() { ("O", attrs.color(Color::rgb(0xFF, 0xFF, 0x00))), ("R", attrs.color(Color::rgb(0xFF, 0x7F, 0x00))), ("N", attrs.color(Color::rgb(0xFF, 0x00, 0x00))), + ], + &[ + ("生活,삶,जिंदगी 😀 FPS", attrs.color(Color::rgb(0xFF, 0x00, 0x00))) ] ]; for &line in lines { diff --git a/src/attrs.rs b/src/attrs.rs index 550f947..bc4ac7b 100644 --- a/src/attrs.rs +++ b/src/attrs.rs @@ -251,8 +251,7 @@ impl AttrsList { /// Clear the current attribute spans pub fn clear_spans(&mut self) { - //Todo: Once clear is added Change this back to clear. - self.spans = RangeMap::new(); + self.spans.clear(); } /// Add an attribute span, removes any previous matching parts of spans