Browse Source
On Android, composing/autocorrect text is written as live text while only a composition region is tracked. IME edit operations (commitText, finishComposingText) are queued and flushed on EndBatchEdit, but SendKeyEvent dispatched the key immediately, bypassing the queue. When a soft keyboard batched "commit autocorrect + press Enter", the newline was inserted before the queued commit flushed. The commit then applied with stale pre-newline composition indices and reset the caret to the end of the committed word, leaving it on the previous line instead of the new one. Route SendKeyEvent through the command queue via a new KeyEventCommand so key events apply in FIFO order with the queued edit commands, honoring Android's InputConnection batch-edit ordering contract. The autocorrect now commits first, then the newline is inserted, leaving the caret on the new line. Outside a batch edit the key is still dispatched immediately, preserving existing behavior; hardware key input uses a separate path and is unaffected. Fixes #21895 Co-authored-by: Emmanuel Hansen <emmausssss@gmail.com>pull/21967/head
committed by
GitHub
3 changed files with 23 additions and 1 deletions
Loading…
Reference in new issue