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
|
|
@ -118,6 +118,10 @@ impl text::Editor for () {
|
|||
|
||||
fn with_text(_text: &str) -> Self {}
|
||||
|
||||
fn is_empty(&self) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
fn cursor(&self) -> text::editor::Cursor {
|
||||
text::editor::Cursor::Caret(Point::ORIGIN)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,9 @@ pub trait Editor: Sized + Default {
|
|||
/// Creates a new [`Editor`] laid out with the given text.
|
||||
fn with_text(text: &str) -> Self;
|
||||
|
||||
/// Returns true if the [`Editor`] has no contents.
|
||||
fn is_empty(&self) -> bool;
|
||||
|
||||
/// Returns the current [`Cursor`] of the [`Editor`].
|
||||
fn cursor(&self) -> Cursor;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue