summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-24 14:52:01 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-07-24 14:52:01 +0200
commite9e06c8fe2ef291b04f6059a841ceb999455bea8 (patch)
tree7a8d1d636d69125762045e0ca431359810064b75 /graphics
parenta5b1a1df548a9bfeefc3e422defe6d67cf61c170 (diff)
downloadiced-e9e06c8fe2ef291b04f6059a841ceb999455bea8.tar.gz
iced-e9e06c8fe2ef291b04f6059a841ceb999455bea8.tar.bz2
iced-e9e06c8fe2ef291b04f6059a841ceb999455bea8.zip
Add `placeholder` support to `text_editor` widget
Diffstat (limited to 'graphics')
-rw-r--r--graphics/src/text/editor.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/graphics/src/text/editor.rs b/graphics/src/text/editor.rs
index 3e6ef70c..80733bbb 100644
--- a/graphics/src/text/editor.rs
+++ b/graphics/src/text/editor.rs
@@ -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