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

Strange behavior when choosing characters #11

Open
ltlnx opened this issue May 30, 2021 · 4 comments
Open

Strange behavior when choosing characters #11

ltlnx opened this issue May 30, 2021 · 4 comments
Assignees
Labels
bug Something isn't working invalid This doesn't seem right

Comments

@ltlnx
Copy link

ltlnx commented May 30, 2021

When there are Emojis and Chinese mixed in the choosing area, the word-choosing behavior is strange. As in the attachments.
Screenshot_20210530-121240_Bromite
Screenshot_20210530-121247_Bromite
Screenshot_20210530-121255_Bromite

@hiroshiyui
Copy link
Owner

@ltlnx It's because the Emoji support in Guileless Bopomofo is implemented by a dirty hack. To give a fully, well designed implementation, I have to spend time to modify the internal design of libchewing, it's a big challenge for me, frankly speaking I can't promise you a milestone or schedule, but I knew the issue and want to solve it.

@ltlnx
Copy link
Author

ltlnx commented May 30, 2021

Ahh I see, take your time!

@hiroshiyui
Copy link
Owner

This issue is also related to android.widget.TextView#getOffsetForPosition which is have weird difficulty to locate character offset correctly, if there is a string like the example provided which has Emoji(s).

Anyway, to solve this issue, I have to consider the nature of Emoji, that is encoded as variant bytes.

@hiroshiyui hiroshiyui added bug Something isn't working invalid This doesn't seem right labels Jun 4, 2021
@hiroshiyui hiroshiyui self-assigned this Jun 4, 2021
@hiroshiyui
Copy link
Owner

hiroshiyui commented Jun 11, 2021

As an example like the following screenshot shown, the "貓咪🐈" pre-edit buffer string is encoded as UTF-8 as 0xe8, 0xb2, 0x93("貓"), 0xe5, 0x92, 0xaa("咪"), 0xf0, 0x9f, 0x90, 0x88("🐈"). We can find that each character has different size of bytes.

device-2021-06-11-180522

Perhaps I should consider to re-implement the whole pre-edit buffer cursor detection logic... at least the android.widget.TextView#getOffsetForPosition one.

ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants