My use case is that I have a widget for wrapping TextInput and handling undo/redo shortcuts if the widget is focused. I'd like to do the same for TextEditor, but it doesn't currently expose a way to check for focus. I added an is_focused method, like the one that TextInput has.
My use case is that I have a widget for wrapping
TextInput
and handling undo/redo shortcuts if the widget is focused. I'd like to do the same forTextEditor
, but it doesn't currently expose a way to check for focus. I added anis_focused
method, like the one thatTextInput
has.I tested both of these checks with these changes:
tree.state.downcast_ref::<iced::widget::text_editor::State<iced::advanced::text::highlighter::PlainText>>().is_focused()
tree.state.downcast_ref::<iced::widget::text_editor::State<iced::highlighter::Highlighter>>().is_focused()