mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
[IL13] Inline restartSuggestionsOnWordBeforeCursor
It's only ever used in one place and makes unhealthy assumptions about what the caller is doing. It's better inlined. Bug: 8636060 Change-Id: I265d5d96894e929d09247ee2e3dc2e81efc2a276
This commit is contained in:
parent
bbe40835a9
commit
cdd8a1a69d
@ -823,10 +823,17 @@ public final class InputLogic {
|
|||||||
final CharSequence word = mConnection.getWordBeforeCursorIfAtEndOfWord(settingsValues);
|
final CharSequence word = mConnection.getWordBeforeCursorIfAtEndOfWord(settingsValues);
|
||||||
if (null != word) {
|
if (null != word) {
|
||||||
final String wordString = word.toString();
|
final String wordString = word.toString();
|
||||||
restartSuggestionsOnWordBeforeCursor(settingsValues, wordString, keyboardSwitcher,
|
mWordComposer.setComposingWord(word,
|
||||||
handler);
|
// Previous word is the 2nd word before cursor because we are restarting on the
|
||||||
|
// 1st word before cursor.
|
||||||
|
getNthPreviousWordForSuggestion(settingsValues, 2 /* nthPreviousWord */),
|
||||||
|
keyboardSwitcher.getKeyboard());
|
||||||
|
final int length = word.length();
|
||||||
|
mConnection.deleteSurroundingText(length, 0);
|
||||||
|
mConnection.setComposingText(word, 1);
|
||||||
|
handler.postUpdateSuggestionStrip();
|
||||||
// TODO: Handle the case where the user manually moves the cursor and then backs up over
|
// TODO: Handle the case where the user manually moves the cursor and then backs up over
|
||||||
// a separator. In that case, the current log unit should not be uncommitted.
|
// a separator. In that case, the current log unit should not be uncommitted.
|
||||||
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
if (ProductionFlag.USES_DEVELOPMENT_ONLY_DIAGNOSTICS) {
|
||||||
ResearchLogger.getInstance().uncommitCurrentLogUnit(wordString,
|
ResearchLogger.getInstance().uncommitCurrentLogUnit(wordString,
|
||||||
true /* dumpCurrentLogUnit */);
|
true /* dumpCurrentLogUnit */);
|
||||||
@ -834,25 +841,6 @@ public final class InputLogic {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Restart suggestions on the word passed as an argument, assuming it is before the cursor.
|
|
||||||
* @param settingsValues the current settings values.
|
|
||||||
*/
|
|
||||||
private void restartSuggestionsOnWordBeforeCursor(final SettingsValues settingsValues,
|
|
||||||
final String word,
|
|
||||||
// TODO: remove these two arguments
|
|
||||||
final KeyboardSwitcher keyboardSwitcher, final LatinIME.UIHandler handler) {
|
|
||||||
mWordComposer.setComposingWord(word,
|
|
||||||
// Previous word is the 2nd word before cursor because we are restarting on the
|
|
||||||
// 1st word before cursor.
|
|
||||||
getNthPreviousWordForSuggestion(settingsValues, 2 /* nthPreviousWord */),
|
|
||||||
keyboardSwitcher.getKeyboard());
|
|
||||||
final int length = word.length();
|
|
||||||
mConnection.deleteSurroundingText(length, 0);
|
|
||||||
mConnection.setComposingText(word, 1);
|
|
||||||
handler.postUpdateSuggestionStrip();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reverts a previous commit with auto-correction.
|
* Reverts a previous commit with auto-correction.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user