Skip to content

Commit 02c6fca

Browse files
committed
Cannot move edit text cursor to first position using character granularity.
Navigating over text backwards by character does not allow the cursor to get at the beginning of the text and it stops one position before the start. Now the cursor can get to index zero which is before the first character. bug:7307336 Change-Id: I109b579835cc080907b20b01e0cf07811e962c6c
1 parent f7f1c6a commit 02c6fca

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

core/java/android/view/View.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7010,10 +7010,12 @@ private boolean previousAtGranularity(int granularity) {
70107010
int current = getAccessibilityCursorPosition();
70117011
if (current == ACCESSIBILITY_CURSOR_POSITION_UNDEFINED) {
70127012
current = text.length();
7013+
setAccessibilityCursorPosition(current);
70137014
} else if (granularity == AccessibilityNodeInfo.MOVEMENT_GRANULARITY_CHARACTER) {
70147015
// When traversing by character we always put the cursor after the character
70157016
// to ease edit and have to compensate before asking the for previous segment.
70167017
current--;
7018+
setAccessibilityCursorPosition(current);
70177019
}
70187020
final int[] range = iterator.preceding(current);
70197021
if (range == null) {

0 commit comments

Comments
 (0)