soupslurpr / BeauTyXT

A beautiful, private, secure, and minimalistic Text, Markdown, and Typst editor.
https://beautyxt.app
ISC License
77 stars 6 forks source link

Backspace to delete letters is misbehaving #152

Open ryrona2 opened 1 month ago

ryrona2 commented 1 month ago

If I rapidly click or hold backspace on the on-screen keyboard, it will randomly delete letters several positions before where the marker is. Either almost always or always the closest space. This is a huge frustration point, as it means I have to click backspace slowly, and I am a fast typist.

Let's say that I want to edit this text because I mistyped (note, marker is the | at the end):

This is a very long sentence where I hvae missplee |

After rapidly clicking or holding backspace, the text becomes:

This is a very longsentencewher|

At this point, it may be tempting to just keep clicking backspace and retype those words too, but that just makes the problem even worse.

This happens on the latest GrapheneOS (version 2024052100) as well as earlier versions too. It happens regardless of keyboard language. It is the built-in keyboard in GrapheneOS, I have not replaced it. BeauTyXT is latest version (0.21.2), and was installed from Accrescent. It is verified genuine by AppVerifier. This problem with misbehaving backspace does not happen in any other app, only BeauTyXT. Factory defaulting the device and reinstalling does not help.

soupslurpr commented 1 month ago

Unfortunately it's an issue with the Jetpack Compose TextField being buggy with AOSP's keyboard. You can see it in other apps that use Jetpack Compose as well such as Accrescent and many others.

ryrona2 commented 3 weeks ago

I looked around a little.

I found these open tickets on Google bug tracker, at least the first one describing this identical issue: https://issuetracker.google.com/issues/294102838 https://issuetracker.google.com/issues/221636606

The tickets have been open since 2022, with many being affected, but no apparent attempts to fix the issues in Jetpack Compose have been made.

Someone wrote this, I don't know if it helps: "I noticed that happening when the code executes on the Dispatchers.Main. I switched the dispatcher to Dispatchers.Default and now the text inputs work fine." (https://issuetracker.google.com/issues/217570481)

Someone else linked to this site that seems to explain a very similar problem and how to fix or work around it in the app using the TextField: https://medium.com/androiddevelopers/effective-state-management-for-textfield-in-compose-d6e5b070fbe5

There is also vague statements about a new TextField implementation coming that lack these issues entirely, so it doesn't have to be worked around.

ryrona2 commented 3 weeks ago

Disabling "Show correction suggestions" makes the problem stop, so it is a race condition with that functionality probably. But that of course makes the keyboard pretty useless in its own way too.

soupslurpr commented 3 weeks ago

Disabling "Show correction suggestions" makes the problem stop, so it is a race condition with that functionality probably. But that of course makes the keyboard pretty useless in its own way too.

Ah I see okay. That makes sense since it was always getting highlighted in a weird way when deleting and triggering the bug.