From 92439e784b327a57e8d77bef733e5b41df9973cb Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 26 Dec 2023 12:12:59 +0000 Subject: [PATCH] All right, ColouredString wants an is_empty() --- src/coloured_string.rs | 1 + src/text.rs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coloured_string.rs b/src/coloured_string.rs index 6efdfc6..cb3a7e1 100644 --- a/src/coloured_string.rs +++ b/src/coloured_string.rs @@ -42,6 +42,7 @@ impl ColouredString { } } + pub fn is_empty(&self) -> bool { self.text.is_empty() } pub fn nchars(&self) -> usize { self.text.chars().count() } pub fn width(&self) -> usize { UnicodeWidthStr::width(&self.text as &str) } diff --git a/src/text.rs b/src/text.rs index aa20f6a..ce803a7 100644 --- a/src/text.rs +++ b/src/text.rs @@ -290,7 +290,7 @@ impl Paragraph { pub fn is_empty(&self) -> bool { match self.words.first() { None => true, - Some(word) => word.nchars() == 0, + Some(word) => word.is_empty(), } } } -- 2.30.2