Merge "Use RichInputConnection to get the previous word."
This commit is contained in:
commit
43ea8f6e77
1 changed files with 6 additions and 25 deletions
|
@ -1374,34 +1374,15 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
callback.onGetSuggestedWords(SuggestedWords.EMPTY);
|
callback.onGetSuggestedWords(SuggestedWords.EMPTY);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Get the word on which we should search the bigrams. If we are composing a word, it's
|
|
||||||
// whatever is *before* the half-committed word in the buffer, hence 2; if we aren't, we
|
|
||||||
// should just skip whitespace if any, so 1.
|
|
||||||
final SettingsValues currentSettings = mSettings.getCurrent();
|
final SettingsValues currentSettings = mSettings.getCurrent();
|
||||||
final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues;
|
final int[] additionalFeaturesOptions = currentSettings.mAdditionalFeaturesSettingValues;
|
||||||
|
mInputLogic.mSuggest.getSuggestedWords(mInputLogic.mWordComposer,
|
||||||
if (DEBUG) {
|
|
||||||
if (mInputLogic.mWordComposer.isComposingWord()
|
|
||||||
|| mInputLogic.mWordComposer.isBatchMode()) {
|
|
||||||
final PrevWordsInfo prevWordsInfo
|
|
||||||
= mInputLogic.mWordComposer.getPrevWordsInfoForSuggestion();
|
|
||||||
// TODO: this is for checking consistency with older versions. Remove this when
|
|
||||||
// we are confident this is stable.
|
|
||||||
// We're checking the previous word in the text field against the memorized previous
|
|
||||||
// word. If we are composing a word we should have the second word before the cursor
|
|
||||||
// memorized, otherwise we should have the first.
|
|
||||||
final PrevWordsInfo rereadPrevWordsInfo =
|
|
||||||
mInputLogic.getPrevWordsInfoFromNthPreviousWordForSuggestion(
|
mInputLogic.getPrevWordsInfoFromNthPreviousWordForSuggestion(
|
||||||
currentSettings.mSpacingAndPunctuations,
|
currentSettings.mSpacingAndPunctuations,
|
||||||
mInputLogic.mWordComposer.isComposingWord() ? 2 : 1);
|
// Get the word on which we should search the bigrams. If we are composing
|
||||||
if (!TextUtils.equals(prevWordsInfo.mPrevWord, rereadPrevWordsInfo.mPrevWord)) {
|
// a word, it's whatever is *before* the half-committed word in the buffer,
|
||||||
throw new RuntimeException("Unexpected previous word: "
|
// hence 2; if we aren't, we should just skip whitespace if any, so 1.
|
||||||
+ prevWordsInfo.mPrevWord + " <> " + rereadPrevWordsInfo.mPrevWord);
|
mInputLogic.mWordComposer.isComposingWord() ? 2 : 1),
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mInputLogic.mSuggest.getSuggestedWords(mInputLogic.mWordComposer,
|
|
||||||
mInputLogic.mWordComposer.getPrevWordsInfoForSuggestion(),
|
|
||||||
keyboard.getProximityInfo(), currentSettings.mBlockPotentiallyOffensive,
|
keyboard.getProximityInfo(), currentSettings.mBlockPotentiallyOffensive,
|
||||||
currentSettings.mAutoCorrectionEnabled, additionalFeaturesOptions, sessionId,
|
currentSettings.mAutoCorrectionEnabled, additionalFeaturesOptions, sessionId,
|
||||||
sequenceNumber, callback);
|
sequenceNumber, callback);
|
||||||
|
|
Loading…
Reference in a new issue