Bug 781038 - Part 1: Span and select the Editable's actual length. r=blassey

This commit is contained in:
Chris Peterson 2012-08-07 15:47:05 -07:00
parent 1753f534be
commit 231bda0d2e

View File

@ -1149,16 +1149,19 @@ class GeckoInputConnection
}
private void setEditable(String contents) {
int prevLength = mEditable.length();
mEditable.removeSpan(this);
mEditable.replace(0, mEditable.length(), contents);
mEditable.setSpan(this, 0, contents.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
Selection.setSelection(mEditable, contents.length());
mEditable.replace(0, prevLength, contents);
int newLength = mEditable.length();
mEditable.setSpan(this, 0, newLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
Selection.setSelection(mEditable, newLength);
}
private void initEditable(String contents) {
mEditable = mEditableFactory.newEditable(contents);
mEditable.setSpan(this, 0, contents.length(), Spanned.SPAN_INCLUSIVE_INCLUSIVE);
Selection.setSelection(mEditable, contents.length());
int newLength = mEditable.length();
mEditable.setSpan(this, 0, newLength, Spanned.SPAN_INCLUSIVE_INCLUSIVE);
Selection.setSelection(mEditable, newLength);
}
protected final boolean hasCompositionString() {