Bug 1014244 - Make backspacing work with single-character compositions. r=wesj

This commit is contained in:
Jim Chen 2014-05-21 15:00:00 -04:00
Родитель 40c49912f7
Коммит 8f2e39c9e7
1 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -368,8 +368,7 @@ public class ToolbarEditText extends CustomEditText
return super.deleteSurroundingText(beforeLength, afterLength);
}
@Override
public boolean setComposingText(final CharSequence text, final int newCursorPosition) {
private boolean removeAutocompleteOnComposing(final CharSequence text) {
final Editable editable = getText();
final int composingStart = BaseInputConnection.getComposingSpanStart(editable);
final int composingEnd = BaseInputConnection.getComposingSpanEnd(editable);
@ -381,7 +380,24 @@ public class ToolbarEditText extends CustomEditText
removeAutocomplete(editable)) {
// Make the IME aware that we interrupted the setComposingText call,
// by having finishComposingText() send change notifications to the IME.
return super.finishComposingText();
finishComposingText();
return true;
}
return false;
}
@Override
public boolean commitText(CharSequence text, int newCursorPosition) {
if (removeAutocompleteOnComposing(text)) {
return false;
}
return super.commitText(text, newCursorPosition);
}
@Override
public boolean setComposingText(final CharSequence text, final int newCursorPosition) {
if (removeAutocompleteOnComposing(text)) {
return false;
}
return super.setComposingText(text, newCursorPosition);
}