Implement :placeholder-shown (fixes #10561)

This commit is contained in:
Anthony Ramine 2016-06-03 13:20:00 +02:00
parent 6c5f5d35f5
commit ff899dc703
7 changed files with 52 additions and 12 deletions

View file

@ -549,6 +549,11 @@ impl<T: ClipboardProvider> TextInput<T> {
}
}
/// Whether the content is empty.
pub fn is_empty(&self) -> bool {
self.lines.len() <= 1 && self.lines.get(0).map_or(true, |line| line.is_empty())
}
/// The length of the content in bytes.
pub fn len(&self) -> usize {
self.lines.iter().fold(0, |m, l| {