diff options
| author | Gilles Debunne <debunne@google.com> | 2010-09-07 18:50:07 -0700 |
|---|---|---|
| committer | Gilles Debunne <debunne@google.com> | 2010-09-09 12:10:41 -0700 |
| commit | 47fa8e800ca3ce56733f7b3a54bace86ad37a1f4 (patch) | |
| tree | 955bf8169e89982509e93763963d84dfc1f8adc5 /core/java | |
| parent | 87e215fd54559935649fb07264ece600bbabbdf9 (diff) | |
Fix for an IndentOutOfBounds in TextField.
Bug http://b/issue?id=2971995
Change-Id: Id6a40e81b26e14c1e5f06ed1bd70ee419c501c69
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/widget/TextView.java | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 861a46d9936f..e97bbfb89116 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -6499,6 +6499,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener if (!mFrozenWithFocus || (selStart < 0 || selEnd < 0)) { // Has to be done before onTakeFocus, which can be overloaded. if (mLastTouchOffset >= 0) { + // Can happen when a TextView is displayed after its content has been deleted. + mLastTouchOffset = Math.min(mLastTouchOffset, mText.length()); Selection.setSelection((Spannable) mText, mLastTouchOffset); } @@ -6515,7 +6517,8 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener // ExtractEditText clears focus, which gives focus to the ExtractEditText. // This special case ensure that we keep current selection in that case. // It would be better to know why the DecorView does not have focus at that time. - if (((this instanceof ExtractEditText) || mSelectionMoved) && selStart >= 0 && selEnd >= 0) { + if (((this instanceof ExtractEditText) || mSelectionMoved) && + selStart >= 0 && selEnd >= 0) { /* * Someone intentionally set the selection, so let them * do whatever it is that they wanted to do instead of |
