-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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 Android LineEdit editing bugs #38309
Conversation
platform/android/java/lib/src/org/godotengine/godot/GodotIO.java
Outdated
Show resolved
Hide resolved
4be5d8a
to
04f1a3a
Compare
Nice work! It looks like a good improvement on the existing system. I was able to consistently reproduce a bug which could be the one you mentioned, and I'm not sure if it should be considered as a separate issue or if there's a problem with this new code in Here are my repro steps:
|
@pouleyKetchoupp Thank you very much for taking the time to test the code !! The problem that you reproduced was due to the same bug that I mentioned - After some more testing, I finally found out that it was due to setMaxInputLength() not being placed at the right location. Setting I still notice some problems with InputFilter. I will push another PR soon. |
04f1a3a
to
630649b
Compare
platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
Show resolved
Hide resolved
TLDR : The LineEdit on Android should be working fine now. === There's still one last minor problem with the virtual keyboard. In the following scenarios, after reaching max length on LineEdit, we will still be able to continue typing on the virtual keyboard (but the LineEdit is not affected) :
As far as I know, TextWatcher is not triggered when we type on the vk in these scenarios. I couldn't find out why. And I think because of this, the InputFilter doesn't filter the text on the vk in these cases. Other than that, the LineEdit should be working well now. |
3cbdb4b
to
86834bd
Compare
Good job! This looks fine to me. For the remaining issue with spaces and suggestions, it seems it's a general problem with the way the length filter works. We might be better off implementing it ourselves in the text watcher, as suggested here: Would you mind opening a new issue with your repro cases? I think this PR is already a great improvement but we'll have to solve these other problems eventually. |
platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
Outdated
Show resolved
Hide resolved
platform/android/java/lib/src/org/godotengine/godot/input/GodotEditText.java
Outdated
Show resolved
Hide resolved
86834bd
to
cc473b9
Compare
Thanks! |
@akien-mga I will test it sometime around tommorow or Friday (if it's not too urgent). |
It should be noted that this same problem occurs with the TextEdit and needs to be fixed as well. |
Can this fix for the LineEdit be applied to the TextEdit please? In 3.2.4 beta 4 this same bug still exists. |
The same fix was done for TextEdit in #43560, it will be part of the next beta. |
I can confirm that this bug still exists in the TextEdit node in 3.3 RC7. |
Please open a dedicated bug report then, this PR is merged, cherry-picked, and related to another node. |
Supersedes #38104
Fixes #27065
Fixes #38158
The first bug is solved by sending cursor_pos in LineEdit to the Android Java side, so that we consider only text until that cursor position. Fix virtual keyboard text not in sync with cursor position on LineEdit #38104 contains more explanation.
The second bug is solved by sending selection.begin and selection.end to the Android Java side, so that text selection in LineEdit is taken into account.
There are still some problems with updates in GodotEditText.java and GodotTextInputWrapper.java that I found during testing in some cases. Sometimes
edit.setText("");
doesn't set the text, sometimes the pCharSequence in beforeTextChanged() gets out of synced, and I believe InputFilter sometimes doesn't get set too.However during my tests this only happens when we have reached max length in LineEdit and we keep typing randomly, or when we spam clicking too fast on the LineEdit. I tried a few things but I couldn't solve this.