Merge change 4965 into donut

* changes:
  Fix bugs 1827027, 1808979, 1820700.
This commit is contained in:
Android (Google) Code Review
2009-06-22 14:31:21 -07:00
2 changed files with 17 additions and 6 deletions

View File

@@ -297,6 +297,10 @@ public class BaseInputConnection implements InputConnection {
b = tmp;
}
if (a <= 0) {
return "";
}
if (length > a) {
length = a;
}
@@ -488,12 +492,12 @@ public class BaseInputConnection implements InputConnection {
} else {
a = Selection.getSelectionStart(content);
b = Selection.getSelectionEnd(content);
if (a >=0 && b>= 0 && a != b) {
if (b < a) {
int tmp = a;
a = b;
b = tmp;
}
if (a < 0) a = 0;
if (b < 0) b = 0;
if (b < a) {
int tmp = a;
a = b;
b = tmp;
}
}

View File

@@ -6469,6 +6469,13 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode != InputMethodManager.RESULT_SHOWN) {
final int len = mText.length();
if (mNewStart > len) {
mNewStart = len;
}
if (mNewEnd > len) {
mNewEnd = len;
}
Selection.setSelection((Spannable)mText, mNewStart, mNewEnd);
}
}