chiark / gitweb /
All right, ColouredString wants an is_empty()
authorSimon Tatham <anakin@pobox.com>
Tue, 26 Dec 2023 12:12:59 +0000 (12:12 +0000)
committerSimon Tatham <anakin@pobox.com>
Tue, 26 Dec 2023 12:12:59 +0000 (12:12 +0000)
src/coloured_string.rs
src/text.rs

index 6efdfc67b404575360a0868190adc9dd15e6a388..cb3a7e142f9f823105fe75497a49b5a862a1b283 100644 (file)
@@ -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) }
 
index aa20f6a91e7c9ea306459a94ce2f322d09d38383..ce803a77f59519d849fde994a7b91c0849b5d9d1 100644 (file)
@@ -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(),
         }
     }
 }