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 backspace on android for AOSP-based keyboards #2232
Conversation
Issue #1941 Gboard always sends backspace events, however, other keyboards only send or enable the backspace based on the state of the textentry. Also, some don't send the event, but instead modify the textentry text itself. This edits the entry to always show some text, a zero. This way the keyboards kill be able to edit/backspace characters. The textChanged then sends a backspace Key Event to the Go code. In the case of using a keyboard (such as Gboard) that sends its own backspace event, we need a way to stop processing of two deletes (the one Gboard sends, and the one textChanged sends). A backspaceDelay timer is used to only process backspaces a certain time (50ms) apart.
What happens if you want to backspace twice? |
After processing a backspace I put another zero in there. :)
Probably, but that's quite a few layers to sift through to push/pop the content back and forth, from what I can tell. I wasn't sure how to even do that. So I did the quick and dirty way. |
Good answers thanks, will try this out :) |
What if the user presses and holds backspace to delete a block of text? |
Works just fine, for me anyway. You see the characters delete as you would expect. I've been testing with the POC code in the linked issue with both Gboard and Openboard. |
I have managed to install the keyboard and see that this has improved things.
|
Interesting, I'll see if I can figure it out. I noticed that if you click to another part of an entry, to move the position of the cursor, it stops working as well. So I have to click off an entry, to get nothing selected, then click back onto an entry. Similar to multiple entry issue, need to click off entry, then click the other one. Can't directly switch cursor from one entry to another. Something to do with how/when the android edittext gets setup maybe. |
Ignoring a request for keyboard when it's already up seems to allow for switching between fyne entry fields. Also fixes the issue I saw where you click to move the cursor within an entry. |
If this works for you I will clean it up to be proper (a pull against mobile repo), and this updating the go.mod and such. Plus it looks like there's conflict I need to resolve. Let me know, thanks. |
merged latest develop branch to fix merge conflict |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I think this functions well now thanks @howeyc, I'll check out the mobile / merged PRs once they are ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks
Gboard always sends backspace events, however, other keyboards only send
or enable the backspace based on the state of the textentry. Also, some
don't send the event, but instead modify the textentry text itself.
This edits the entry to always have some text, a zero. This way the
keyboards will be able to edit/backspace characters. The textChanged
then sends a backspace Key Event to the Go code.
In the case of using a keyboard (such as Gboard) that sends its own
backspace event, we need a way to stop processing of two deletes (the
one Gboard sends, and the one textChanged sends). A backspaceDelay timer
is used to only process backspaces a certain time (50ms) apart.
Fixes #1941
Checklist: