Repro steps:
1. Go to google.com
2. Type 'hello world'
3. Move the cursor to the start of 'world'.
4. Call the following InputConnection methods.
beginBatchEdit()
finishComposingText()
deleteSurroundingText(0, 5)
commitText('"', 1)
commitText('world', 1)
setSelection(7, 7)
setComposingText('', 1)
endBatchEdit()
Expected result:
The cursor should be moved to 7.
Actual result:
The cursor is sometimes moved to 12.
I suspect that this happens because
setSelection() is applied earlier than the original order because
it's a frame message and the rest are input messages, and they go to different message loops.
Originally reported at b/27962445. Copied the priority from the original bug.
Comment 1 by changwan@chromium.org
, Apr 12 2016