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

Fix virtual keyboard text not in sync with cursor position on LineEdit #38104

Closed
wants to merge 1 commit into from

Conversation

SkyLucilfer
Copy link
Contributor

@SkyLucilfer SkyLucilfer commented Apr 22, 2020

Note : I'm making this PR against 3.2 branch. I can change to master if required.

Fixes #27065

PR description
So the problem was that we were sending the whole LineEdit text to the virtual keyboard even if the cursor is at the middle of the LineEdit text.
This makes modification behave erratically when the cursor is not at the end of LineEdit.

For example, if we have
ABC|DE

The text we send to virtual keyboard : ABCDE
If we type 'u' in this case, virtual keyboard will add 'u' to the end of the text (based on Android and Iphone implementation), which results in ABCDEu
After that, ABCDEu will be sent back to the LineEdit at the cursor position, which results in ABCDEuDE.

I have changed it so that we send only the text until the cursor position to the virtual keyboard (which is the behaviour of my vk that I observe when I type with my phone.)

@SkyLucilfer SkyLucilfer changed the title Fix virtual keyboard text not in sync with cursor position Fix virtual keyboard text not in sync with cursor position on LineEdit Apr 22, 2020
@SkyLucilfer
Copy link
Contributor Author

SkyLucilfer commented Apr 23, 2020

After a lot of testing I found there's some regression with this PR. Specifically this :
If we type to max length in LineEdit, move the cursor to the front, then we will be able to continue typing on the virtual keyboard, behaving exactly like this #32709

I don't really see a way to solve this other than adding a fourth parameter to show_virtual_keyboard(), such as cursor_pos. Then we would have show_virtual_keyboard(text, cursor_pos, get_global_rect(), max_length)

There's also overlapping of bugs from #38158

@akien-mga akien-mga added this to the 3.2 milestone Apr 29, 2020
@SkyLucilfer SkyLucilfer deleted the 32AndroidLineEdit branch May 21, 2020 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants