Set pending when compositionend event is dispatched #326
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "dispatch-compositionend"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I noticed to change autocompletion state to
Resultwhen enter key is pressed with Japanese IME (e.g. Google IME). So I can not autocomplete text.This PR will fix it by changing autocompletion state to
Pendingwhen thecompositionendevent is dispatched.The problem, as far as I can see (using Linux's IBus IME), is that when the IME menu is open, the selection is moved to the start of the composition, confusing the completion (in the case where the composition starts a word it won't complete anything, in cases where it continues a word it'll only complete up to the selection start). Then when the composition finishes, the cursor is moved to its end, but since that transaction doesn't change the document, the completion state isn't appropriately updated and no completion is started for the composed text.
Thanks for coming up with a patch. However, I don't think it's a good idea to fire a transaction for this, especially since event delivery order around compositions is a bit of a mess, and thus this new transaction might end up being ordered strangely relative to the document or selection changes caused by the composition end.
Path
0ef664dadds a little state machine to the completion plugin that checks for the problematic situation (composition made changes, but then moved the selection before ending), and manually restarts completion when that occurs. Does that work for you? (I only tested with Firefox/Linux so far.)Thank you for your review and the commit! I tried on latest master and it doesn't work that I expected. (Tested with macOS/Chrome/Google IME)
But the
startCompletionEffectwhich you added is useful. I can create a plugin which I want like this (may be tricky...):I understand that my patch has problem. I'll close this PR and try to customise by creating a plugin.
Thank you!
Pull request closed