-
-
Notifications
You must be signed in to change notification settings - Fork 56
Description
The current behaviour of text editors in scroll views is backend-specific; we don't do any automatic scrolling from within SwiftCrossUI.
Some backends (I believe WinUIBackend?) automatically scroll to keep the cursor in view, while others (such as AppKitBackend and UIKitBackend) do not.
Additionally, some backends (I believe Gtk3Backend?) scroll as soon as you click on the text editor, causing some weird behaviour (I'm not sure what Gtk 3 backend is aiming for when it scrolls on focus; it seems a little random).
We should expand the AppBackend protocol so that SwiftCrossUI has the information it needs to perform this automated scrolling, and then implement this scrolling logic within SwiftCrossUI to make it standard across platforms (and perhaps even configurable?). We'll have to also figure out how to disable the existing scrolling behaviour of backends that already attempt some form of scrolling.
I've looked into this a little bit, and most backends should be able to provide text cursor coordinates pretty easily. WinUI might make things a bit tricky though. I've found a way to convert coordinates to an insertion index, but not the other way around.