iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm
https://iced.rs
MIT License
22.96k stars 1.06k forks source link

Allow checking whether a `TextEditor` is focused #2386

Closed mtkennerly closed 1 month ago

mtkennerly commented 1 month ago

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.

I tested both of these checks with these changes: