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

removed the last of the legacy Backspace hack #318

Merged
merged 3 commits into from
Jul 28, 2023
Merged

Conversation

alexknop
Copy link
Contributor

Problem:

When testing on a consumer cellular link ii where the clear key also doubles as the back key:
image and it is meant to delete text when there is text, otherwise double as a back key for system navigation.
I was not able to back out of a text conversation because I would be on a textbox which calls for the keypad and isBackspaceHandled was always returning true here. It wasn't returning true because of onBackspace() but because the keyCode was 67 (KeyEvent.KEYCODE_DEL) and was returning true for the second part of the OR statement.

Solution:

Removed second part of conditional. onBackspace() already checks whether there's text or if it's in passthrough. Open to discussing the logic here, but it doesn't seem necessary to have this OR statement.

@sspanak
Copy link
Owner

sspanak commented Jul 27, 2023

A long time ago, all the logic for the combined del/back keys used to be in onKeyDown(). And with time, I slowly refactored the code and moved the logic to more appropriate places such as onBackspace() and the Key class.

For a moment I thought this would break Backspace on my phone, because it works the opposite way. It has a true BACK key (code=4), that is also used for deleting text, when there is text, but Key.isBackspace() and onBackspace() handle everything properly now, so it's finally safe to delete the last part of the hack.

All this is absolutely useless information, unless you were curious what's with this line of code. 😄

Let's delete it, but please, also delete the comment above, as I noted in the other comment.

@sspanak
Copy link
Owner

sspanak commented Jul 27, 2023

Thank you very much for your efforts and for putting everything in separate branches. It is so much easier for me test the PRs this way.

alexknop and others added 2 commits July 27, 2023 10:09
@sspanak sspanak changed the title removed keycode logic removed the last of the legacy Backspace hack Jul 28, 2023
@sspanak sspanak merged commit 49eda37 into sspanak:master Jul 28, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants