summaryrefslogtreecommitdiff
path: root/core/java/android/widget
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2010-10-04 16:45:32 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-04 16:45:32 -0700
commit8556efe5a34d8fc6ed99f1fdae60fa41b7647920 (patch)
tree2f3f146526d043d9fc1dc7b6db84a90e25ce984d /core/java/android/widget
parent196894cdcc6883ed141ec0f6f2f577dbc613e08f (diff)
parenta29643a6455df7d3d615cdc45e11c437fe4b6cee (diff)
am a29643a6: Merge "DO NOT MERGE. Select word no longer selects spaces between words." into gingerbread
Merge commit 'a29643a6455df7d3d615cdc45e11c437fe4b6cee' into gingerbread-plus-aosp * commit 'a29643a6455df7d3d615cdc45e11c437fe4b6cee': DO NOT MERGE. Select word no longer selects spaces between words.
Diffstat (limited to 'core/java/android/widget')
-rw-r--r--core/java/android/widget/TextView.java45
1 files changed, 1 insertions, 44 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index e1dcbe721b13..535047819ce5 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -7242,50 +7242,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
((SelectionModifierCursorController) mSelectionModifierCursorController);
int minOffset = selectionModifierCursorController.getMinTouchOffset();
int maxOffset = selectionModifierCursorController.getMaxTouchOffset();
-
- if (minOffset == maxOffset) {
- int offset = Math.max(0, Math.min(minOffset, mTransformed.length()));
-
- // Tolerance, number of charaters around tapped position
- final int range = 1;
- final int max = mTransformed.length() - 1;
-
- // 'Smart' word selection: detect position between words
- for (int i = -range; i <= range; i++) {
- int index = offset + i;
- if (index >= 0 && index <= max) {
- if (Character.isSpaceChar(mTransformed.charAt(index))) {
- // Select current space
- selectionStart = index;
- selectionEnd = selectionStart + 1;
-
- // Extend selection to maximum space range
- while (selectionStart > 0 &&
- Character.isSpaceChar(mTransformed.charAt(selectionStart - 1))) {
- selectionStart--;
- }
- while (selectionEnd < max &&
- Character.isSpaceChar(mTransformed.charAt(selectionEnd))) {
- selectionEnd++;
- }
-
- Selection.setSelection((Spannable) mText, selectionStart, selectionEnd);
- return;
- }
- }
- }
-
- // 'Smart' word selection: detect position at beginning or end of text.
- if (offset <= range) {
- Selection.setSelection((Spannable) mText, 0, 0);
- return;
- }
- if (offset >= (max - range)) {
- Selection.setSelection((Spannable) mText, max + 1, max + 1);
- return;
- }
- }
-
+
long wordLimits = getWordLimitsAt(minOffset);
if (wordLimits >= 0) {
selectionStart = (int) (wordLimits >>> 32);