Fix incorrect ending selection after InputMethodController::SetComposition()
InputMethodController::SetComposition() works as follows: 1. The current composition range is selected (we don't show this to users). 2. The selection is replaced with the new text, which is left selected. 3. The resulting selection is converted to a composition range, and we change the selection to whatever the IME requested be selected afterwards. Step 2 causes the open TypingCommand's ending selection to be set to the resulting composition range. We need to update it after step 3 to fix two problems: 1. Pressing enter on a physical keyboard on Android with an open composition range causes the text in the composition range to be incorrectly deleted. 2. Pressing Ctrl-Z to undo causes each word to be selected in turn (see video on https://crbug.com/787598). There's another problem with undo on Android, which is that the TypingCommand is closed out after every call to SetComposition() when we select the composition, which means undo only undoes one character at a time. I might fix this in a separate CL. Bug: 787598, 772565, 772584 Change-Id: I29f09e3c0bd97c6c8e17e5455c5579b53aa34c1b Reviewed-on: https://chromium-review.googlesource.com/783770 Commit-Queue: Ryan Landay <rlanday@chromium.org> Reviewed-by:Changwan Ryu <changwan@chromium.org> Reviewed-by:
Xiaocheng Hu <xiaochengh@chromium.org> Reviewed-by:
Yoshifumi Inoue <yosin@chromium.org> Cr-Commit-Position: refs/heads/master@{#520857}
Showing
Please register or sign in to comment