-
Notifications
You must be signed in to change notification settings - Fork 230
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
Android - Creating a non-text node and selecting it after the text with OS IME suggestions on the keyboard causes an exception. #2070
Comments
@snowb1shop your issue description mentions two programmatic steps. Please include a minimal, runnable code sample that demonstrates this problem. |
Hey, thanks for the answer. I’ve forked the supereditor package from the main branch and created a demo. The commit is really small: 1510658 Only creating a horizontal rule node and placing the selection on it. To find the issue run the example's main.dart demo on Android, place the caret on the paragraph text, start writing, see the suggestions from the keyboard and then click to create a horizontal rule node from the toolbar. Link to the fork: https://github.com/snowb1shop/super_editor
|
@snowb1shop we ask for self-contained runnable reproductions. It's a friction to pull down an entire fork of the repo just to see the bug. Can you please create a minimal runnable entrypoint with just enough code to recreate the issue and post that as a code block in this issue? |
Here is the updated demo:
|
@snowb1shop @matthew-carroll This happens because, on Android, when we tap at a word, Android generates a composing region for that word. In the sample code, the selection is being changed to a non-text node, but we keep the composing region of the previously selected word. As a result, we are trying to apply an invalid composing region. Adding a In the places that |
Thanks, it worked after adding what you suggested. In my opinion it makes sense to include it in the |
Package Version
super_editor, GitHub, stable branch
To Reproduce
Minimal Reproduction Code
This issue only occurs on Android when there is already text that has suggestions (see the video for details). Adding the node doesn't cause a crash, but selecting it afterwards does.
The issue cannot be reproduced in the demo since the demo doesn’t allow for adding a node, such as a divider, while having the caret on the text element.
Actual behavior
Crash
Expected behavior
Horizontal ruler is added, selection is changed to horizontal ruler node
Platform
Android
Flutter version
Flutter v. 3.22.1
Screenshots
https://github.com/superlistapp/super_editor/assets/18536122/51895511-c15d-4ff5-bff4-bd594e97200e
The text was updated successfully, but these errors were encountered: