AOSP keyboard deletes another character than the one before the cursor when pressing backspace in compose BasicTextField
Using the AOSP Keyboard (doesn't happen with GBoard) on androidx.compose.foundation.text.BasicTextField removes the last space, even though another character was before the cursor. This can happen with line-feeds as well. I observed this behavior several times editing real text, but below is also a more artificial example, how to reproduce this error. On my device (dumpling with lineage-18.1) this reproduces the error every time. Auto-correction is disable both by device settings and code. The issue affects at least the compose versions between 1.0.1
and 1.2.0-alpha03
.
Expected Behavior
When typing characters and later pressing backspace the characters are removed in the order in which they were typed. In the reproducible example given below, I expected to get the text "aaaaa " in the BasicTextField.
Current Behavior
Instead I get the text "aaaaaa".
See:
screen-20220216-001839
Possible Solution
No idea, but this error only occurs only on keyboards, that are based on the AOSP Keyboard, which makes me assume that this is a AOSP Keyboard issue and not a compose issue. Affected are:
- AOSP Keyboard (the preinstalled one from LineageOS)
- OpenBoard
Unaffected are:
Steps to Reproduce
- Create a compose project with AndroidStudio and replace the call to the Greeting fun with:
val (text, setText) = remember { mutableStateOf("aaaaa") } BasicTextField(value = text, onValueChange = setText, keyboardOptions = KeyboardOptions(autoCorrect = false), modifier = Modifier.fillMaxSize())
- Install and open the app
- Click on the TextField and type " aa aa"
- Click 5 times on Backspace
/device dumpling /version lineage-18.1 /date 2022-02-15 /kernel 4.4.302-lineage+ /baseband .c4.7-00070-8998_GEN_PACK-2.271073.1.277412.1 /mods OpenGAPPS-nano
I have read the directions. lineage-bug.txt