The Emoji Keyboard Has Grapheme Cluster error
BulkinKing opened this issue ยท 2 comments
**It Does happen in OpenBoard too
Describe the bug
When you Type any Emoji with zero width joiner it handles the most recent emoji correctly but Creates issue in remaining emoji
To Reproduce
Steps to reproduce the behavior:
- Go to Emoji Section
- Click on People Category
- Scroll down to any Family emoji or colored emoji or Flags Category eg:๐ฉโ๐ฉโ๐ง๐ฉโ๐ฉโ๐งโ๐ฆ๐ฉโ๐ฉโ๐ฆโ๐ฆ๐๐ฟ๐๐ฟ๐บ๐ธ๐ฑ๐ฐ๐ฎ๐ณ it handles the most recent emoji correctly**
Expected behavior
The whole cluster must be removed on backspace pressed the most recent cluster will be removed as in the example ๐ฉโ๐ฉโ๐ง๐ฉโ๐ฉโ๐งโ๐ฆ๐ฉโ๐ฉโ๐ฆโ๐ฆ๐๐ฟ๐๐ฟ๐บ๐ธ๐ฑ๐ฐ๐ฎ๐ณ the Indian flag will be removed correctly other will create issue on backspace press
Screenshots
If applicable, add screenshots to help explain your problem
Smartphone (please complete the following information):
- Device: Poco X3/Redmi note 9/Honor 6x
- OS: 12/12/7
The problem seems to be in https://github.com/Helium314/openboard/blob/aba68b114beead9c11aa939d3098774718af597c/app/src/main/java/org/dslul/openboard/inputmethod/latin/inputlogic/InputLogic.java#L1188-L1190
lengthToDelete
is always 2 for emojis, but the actual necessary length may be (much!) more and depends on the emoji.
How to get the correct length? I have no idea...
Using sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL)
when pressing delete works, but this causes issues with suggestions.