Skip to content
Snippets Groups Projects
Commit 6a58bb7a authored by Jean Chalard's avatar Jean Chalard
Browse files

Add suggestion span upon starting a gesture.

Bug: 7196761
Change-Id: If60cb809b205159ced1887f94b7caf9775fcf3bb
parent 65ef2608
No related branches found
No related tags found
No related merge requests found
...@@ -862,6 +862,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ...@@ -862,6 +862,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSpaceState = SPACE_STATE_NONE; mSpaceState = SPACE_STATE_NONE;
if ((!mWordComposer.isComposingWord()) || selectionChanged || noComposingSpan) { if ((!mWordComposer.isComposingWord()) || selectionChanged || noComposingSpan) {
// If we are composing a word and moving the cursor, we would want to set a
// suggestion span for recorrection to work correctly. Unfortunately, that
// would involve the keyboard committing some new text, which would move the
// cursor back to where it was. Latin IME could then fix the position of the cursor
// again, but the asynchronous nature of the calls results in this wreaking havoc
// with selection on double tap and the like.
// Another option would be to send suggestions each time we set the composing
// text, but that is probably too expensive to do, so we decided to leave things
// as is.
resetEntireInputState(newSelStart); resetEntireInputState(newSelStart);
} }
...@@ -1087,11 +1096,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen ...@@ -1087,11 +1096,8 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if (!mWordComposer.isComposingWord()) return; if (!mWordComposer.isComposingWord()) return;
final CharSequence typedWord = mWordComposer.getTypedWord(); final CharSequence typedWord = mWordComposer.getTypedWord();
if (typedWord.length() > 0) { if (typedWord.length() > 0) {
mConnection.commitText(typedWord, 1); commitChosenWord(typedWord, LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD,
final CharSequence prevWord = addToUserHistoryDictionary(typedWord); separatorString);
mLastComposedWord = mWordComposer.commitWord(
LastComposedWord.COMMIT_TYPE_USER_TYPED_WORD, typedWord.toString(),
separatorString, prevWord);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment