Implement blinking cursor for text_editor

This commit is contained in:
Héctor Ramón Jiménez 2024-07-29 00:51:46 +02:00
parent d1fa9537f6
commit 695721e120
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
2 changed files with 90 additions and 28 deletions

View file

@ -1210,21 +1210,6 @@ impl<P: text::Paragraph> State<P> {
Self::default()
}
/// Creates a new [`State`], representing a focused [`TextInput`].
pub fn focused() -> Self {
Self {
value: paragraph::Plain::default(),
placeholder: paragraph::Plain::default(),
icon: paragraph::Plain::default(),
is_focused: None,
is_dragging: false,
is_pasting: None,
last_click: None,
cursor: Cursor::default(),
keyboard_modifiers: keyboard::Modifiers::default(),
}
}
/// Returns whether the [`TextInput`] is currently focused or not.
pub fn is_focused(&self) -> bool {
self.is_focused.is_some()