Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add TextEditor core provider, rewrite TextInput UI element on top of it #8575

Open
misl6 opened this issue Jan 20, 2024 · 1 comment
Open
Milestone

Comments

@misl6
Copy link
Member

misl6 commented Jan 20, 2024

Similar to #8574, handling text input internationally is a painful task, and sometimes we do not even have a proper API to handle it, as text input is something strictly tied with the OS-backed TextEdit widget. (This is not just Kivy's case, but also other frameworks are on the same boat).

The current status:

  • The window provider (SDL in most cases) does not have (and is not required to?) all the events and methods to access the complete feature set that the (mostly mobile) platforms offer.

  • We currently only support basic text input methods (we receive keystrokes from the keyboard and change the TextInput widget text property accordingly). This may be fine for languages that do not require an Input Method Editor (IME) to input text.

  • The window provider (SDL in that case) is not able to handle multiple TextInput fields at the same time. That breaks the keyboard suggestions for us.

  • The current implementation does not allow us to handle autofills (E.g. for password managers)

  • The current implementation does not allow us to handle accessibility features on textinputs.

We have a POC #8226, whose major intention was to test the feasibility of using OS-backed hidden widgets to get the events. That worked quite fine. We need to find out how to manage it for Desktop platforms, and write a unified API + keep the support for the legacy (keystrokes) version.

Please note that this issue is partially on hold until #8574 is assessed, since kivy.ui.textinput will use TextLayout core provider (for layouting, rendering, getting selection rectangles, getting glyph at cursor pos, ...) and TextEditor core provider for handling the textedit events.

Related issues to consider:

@misl6 misl6 added this to the 3.0.0 milestone Jan 20, 2024
@Julian-O
Copy link
Contributor

textinput.py stands at 4,050 lines of code. TextInput is a single class with 3,600 lines of code.

This would be an excellent opportunity to break it down into much, much smaller parts with subclassing, mixins, delegation, etc. and improve unit-test coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Backlog
Development

No branches or pull requests

2 participants