Remove a useless code path (A7)
This is never called any more, since we now use the cancelCommit path to react to a backspace after a manual pick. This concludes the run of changes to implement feature request #5968922 Change-Id: I23df653bb2a3de2ba0152394d5d616a42ac7519bmain
parent
bdf89ce5fe
commit
4fef31510d
|
@ -1449,20 +1449,15 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// See the comment above: must be careful about resuming auto-suggestion.
|
// No cancelling of commit/double space/swap: we have a regular backspace.
|
||||||
if (mSuggestionsView != null && mSuggestionsView.dismissAddToDictionaryHint()) {
|
// We should backspace one char and restart suggestion if at the end of a word.
|
||||||
// Go back to the suggestion mode if the user canceled the
|
|
||||||
// "Touch again to save".
|
|
||||||
// TODO: this code path is not used any more. Verify & delete.
|
|
||||||
restartSuggestionsOnManuallyPickedTypedWord(ic);
|
|
||||||
} else {
|
|
||||||
// Here we must check whether there is a selection. If so we should remove the
|
|
||||||
// selected text, otherwise we should just delete the character before the cursor.
|
|
||||||
if (mLastSelectionStart != mLastSelectionEnd) {
|
if (mLastSelectionStart != mLastSelectionEnd) {
|
||||||
|
// If there is a selection, remove it.
|
||||||
final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart;
|
final int lengthToDelete = mLastSelectionEnd - mLastSelectionStart;
|
||||||
ic.setSelection(mLastSelectionEnd, mLastSelectionEnd);
|
ic.setSelection(mLastSelectionEnd, mLastSelectionEnd);
|
||||||
ic.deleteSurroundingText(lengthToDelete, 0);
|
ic.deleteSurroundingText(lengthToDelete, 0);
|
||||||
} else {
|
} else {
|
||||||
|
// There is no selection, just delete one character.
|
||||||
if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) {
|
if (NOT_A_CURSOR_POSITION == mLastSelectionEnd) {
|
||||||
// This should never happen.
|
// This should never happen.
|
||||||
Log.e(TAG, "Backspace when we don't know the selection position");
|
Log.e(TAG, "Backspace when we don't know the selection position");
|
||||||
|
@ -1477,7 +1472,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// ic may be null
|
// ic may be null
|
||||||
private boolean maybeStripSpaceWhileInBatchEdit(final InputConnection ic, final int code,
|
private boolean maybeStripSpaceWhileInBatchEdit(final InputConnection ic, final int code,
|
||||||
|
@ -2202,36 +2196,6 @@ public class LatinIME extends InputMethodServiceCompatWrapper implements Keyboar
|
||||||
mHandler.postUpdateSuggestions();
|
mHandler.postUpdateSuggestions();
|
||||||
}
|
}
|
||||||
|
|
||||||
// "ic" must not be null
|
|
||||||
private void restartSuggestionsOnManuallyPickedTypedWord(final InputConnection ic) {
|
|
||||||
// Note: this relies on the last word still being held in the WordComposer, in
|
|
||||||
// the field for suggestion resuming.
|
|
||||||
// Note: in the interest of code simplicity, we may want to just call
|
|
||||||
// restartSuggestionsOnWordBeforeCursorIfAtEndOfWord instead, but retrieving
|
|
||||||
// the old WordComposer allows to reuse the actual typed coordinates.
|
|
||||||
mWordComposer.resumeSuggestionOnLastComposedWord(mLastComposedWord);
|
|
||||||
// We resume suggestion, and then we want to set the composing text to the content
|
|
||||||
// of the word composer again. But since we just manually picked a word, there is
|
|
||||||
// no composing text at the moment, so we have to delete the word before we set a
|
|
||||||
// new composing text.
|
|
||||||
final int restartLength = mWordComposer.size();
|
|
||||||
if (DEBUG) {
|
|
||||||
final String wordBeforeCursor = ic.getTextBeforeCursor(restartLength, 0).toString();
|
|
||||||
if (!TextUtils.equals(mWordComposer.getTypedWord(), wordBeforeCursor)) {
|
|
||||||
throw new RuntimeException("restartSuggestionsOnManuallyPickedTypedWord "
|
|
||||||
+ "check failed: we thought we were reverting \""
|
|
||||||
+ mWordComposer.getTypedWord()
|
|
||||||
+ "\", but before the cursor we found \""
|
|
||||||
+ wordBeforeCursor + "\"");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ic.deleteSurroundingText(restartLength, 0);
|
|
||||||
mComposingStateManager.onStartComposingText();
|
|
||||||
ic.setComposingText(mWordComposer.getTypedWord(), 1);
|
|
||||||
mHandler.cancelUpdateBigramPredictions();
|
|
||||||
mHandler.postUpdateSuggestions();
|
|
||||||
}
|
|
||||||
|
|
||||||
// "ic" must not be null
|
// "ic" must not be null
|
||||||
private boolean revertDoubleSpaceWhileInBatchEdit(final InputConnection ic) {
|
private boolean revertDoubleSpaceWhileInBatchEdit(final InputConnection ic) {
|
||||||
mHandler.cancelDoubleSpacesTimer();
|
mHandler.cancelDoubleSpacesTimer();
|
||||||
|
|
Loading…
Reference in New Issue