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
Characters reappearing sometimes when erasing (backspace) #2679
Comments
We, indeed, had many fixes around that area, but I assume not everything is fixed. |
Hello, I was able to finally get it to reproduce. It's very inconsistent. I was able to reproduce it twice in a minute by beeing in "incognito-mode". I don't know if it has any link with the issue as I'm pretty sure it happens in normal typing also Let me know if I can do anything more to help! screenrecording-ask.mp4 |
thanks. |
In this screen recording, I am using Fennec (Firefox build on F-Droid) but it happened in multiple other apps also (Signal, Element, firefox, etc) I just got it happen again on Signal in "normal" (non-icognito) mode so I don't know if there's any relation to the app/keyboard mode being used |
Can you disable animations completely? In AnySoftKeyboard settings -> UI -> Keyboard Effect -> Animations. Set yo None. |
I just disabled it and was able to reproduce the issue. I used to use the power-saving theme which had no animation and it also did the same. |
yes, please try a build from the latest master. I added some logs there around that area. Thank you! |
I will pull and rebuild my keyboard, for now that's what I had: Normal erase
Erase when it add a character after:
I will rebuild and get the logs and will let you know |
The log I got from the new build is similar, but I found out that it seems to always happen with the last character of a word. I typed "abcdefghijklmnop " a few times and it always happen with the "p" log from my "debug" build pulled from master 5 minutes ago:
I'll try to dig in the code from my side, but I didn't work on an Android app for a long time. If I can do anything else to help you, let me know! |
This helps a lot. I'll try to retrace what went wrong. Two things that look wrong:
|
Here's my observations so far:
I redid a test and tried to record+logcat it to watch it slowly.
When that happens:
The "OnUpdateSelection" parameters seems fine, but the mWord.getTypedWord() and mWord.cursorPosition() looks off (didn't erase the last character because of the following backspace being registered?) I will dig more, but here's my logs and the slowmotion video: When prediction start correctly:
When it doesn't:
Video: untitled.mp4Full log (Including the previous word, for comparison)
|
I think there's a missing step in the code that handles the "cursorMovedUnexpectedly", because in my case, the cursor moved due to a character being erased AnySoftKeyboard/ime/app/src/main/java/com/anysoftkeyboard/ime/AnySoftKeyboardSuggestions.java Line 475 in 9ab232e
The cursor is moved to the correct position, but mWord isn't updated.
We obviously need to make sure we were removing the character before removing it from mWord, as cursorMovedUnexpectedly can happen for other reasons. I couldn't find a way to check that the last key registered was -5. I'm not used to the Android Framework so you might be able to add that easily! I'm not sure if my checks makes sens in all cases, so I'll let you manage that. I hope I provided enough info for you to be able to fix the issue correctly! Let me know if I can help more! Thanks a lot for your nice work by the way |
Will your code change delete the last character if you simply hit the left arrow? |
This is a crazy good analysis! Thank you. |
I am using that fix since then and it didn't happen so far. I guess it could delete a character in other situations (that's why I was willing to check the last typed key) but it would need to trigger a cursorMovedUnexpectedly, have the cursor at the end of a word AND have moved left to happen. Appart from registering a key while still doing some stuff, I don't know if cursorMovedUnexpectly gets triggered a lot. To be quick enought to trigger it, I have to type the same key quite quickly (having a debug build help to trigger it because of logging) so I don't think it would trigger the delete in other situations, but I don't have a huge understanding of the whole thing. I guess it doesn't necessarily fix all situations either as you may be deleting from the middle of a word which wouldn't meet I don't know how to handle that in a better way, sadly :( |
This is a possible fix for AnySoftKeyboard#2679
Could you try the fix at #2696 |
This is a possible fix for AnySoftKeyboard#2679
It works for me so far, I wasn't able to reproduce the bug. I'll use that build for a few days and will update you if there's anything! Thanks for your time |
That's good to hear. Please report if you encounter anything new, too |
Merged the fix to master. Thank you for your thorough analysis |
Looks like it introduce another bug. If you move your cursor by clicking somewhere else and then start erasing, it doesn't always move the cursor posituon and sometimes erase from where you were before the cursor was moved I'll try to analysis the logcat debug log tonight as I did with the previous bug to give you as much info as possible. Should I open a seperate bug? |
I can ignore that last comment, right? As per that other issue you opened and closed. |
Yes, sorry for the misunderstanding! |
Sometimes, when erasing text using the backspace button, some previously erased characters re-appears. I thought the bug might be fixed by now (as the release in the Play Store and F-Droid is a bit old) so I built it from source (master branch), but the problem is the same.
Steps to reproduce
Expected behaviour
Erasing a character should (obviously) erase it and it shouldn't reappear after the cursor
Actual behaviour
From time to time (I was not able to get a pattern), a previously erased character re-appear after the cursor
Android OS version:
Android 10
Device manufacturer and model:
One Plus 6T
List of installed add-ons (like languages, or themes):
French Language Pack
The text was updated successfully, but these errors were encountered: