Commit b8578002 authored by Darren Shen's avatar Darren Shen Committed by Commit Bot

ime: Keep cursor when confirming composition for SetCompositionRange.

SetCompositionRange needs to confirm existing composition first before
starting a new composition. When doing so, it should keep the cursor
position the same. Otherwise, the cursor may move as the result of a
SetCompositionRange call, which then causes some IMEs to get stuck in
a loop.

The contract for SetCompositionRange is to keep the cursor in the same
position, so changing the code to match that.

Bug: 1010329
Change-Id: I011530e4a32c617c36736ff0c1be5351415f0cb2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2340116Reviewed-by: default avatarKeith Lee <keithlee@chromium.org>
Commit-Queue: Darren Shen <shend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#795759}
parent 8b1243a3
...@@ -503,7 +503,7 @@ bool InputMethodEngineBase::SetCompositionRange( ...@@ -503,7 +503,7 @@ bool InputMethodEngineBase::SetCompositionRange(
// When there is composition text, commit it to the text field first before // When there is composition text, commit it to the text field first before
// changing the composition range. // changing the composition range.
ConfirmCompositionText(/* reset_engine */ false, /* keep_selection */ false); ConfirmCompositionText(/* reset_engine */ false, /* keep_selection */ true);
std::vector<ui::ImeTextSpan> text_spans; std::vector<ui::ImeTextSpan> text_spans;
for (const auto& segment : segments) { for (const auto& segment : segments) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment