Add placeholder support to text_editor widget
This commit is contained in:
parent
a5b1a1df54
commit
e9e06c8fe2
5 changed files with 68 additions and 9 deletions
|
|
@ -82,6 +82,13 @@ impl editor::Editor for Editor {
|
|||
})))
|
||||
}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
let buffer = self.buffer();
|
||||
|
||||
buffer.lines.is_empty()
|
||||
|| (buffer.lines.len() == 1 && buffer.lines[0].text().is_empty())
|
||||
}
|
||||
|
||||
fn line(&self, index: usize) -> Option<&str> {
|
||||
self.buffer()
|
||||
.lines
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue