From: Simon Tatham Date: Tue, 26 Dec 2023 12:12:59 +0000 (+0000) Subject: All right, ColouredString wants an is_empty() X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=92439e784b327a57e8d77bef733e5b41df9973cb;p=mastodonochrome.git All right, ColouredString wants an is_empty() --- 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(), } } }