Merge change 4965 into donut
* changes: Fix bugs 1827027, 1808979, 1820700.
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user