am f0522882: Merge "Insertion cursor: add some slop for moving between lines" into mnc-dev

* commit 'f05228822c5da6333f20dc3a29c8f064b7562e06':
  Insertion cursor: add some slop for moving between lines
This commit is contained in:
Mady Mellor
2015-06-17 17:13:56 +00:00
committed by Android Git Automerger

View File

@@ -4013,7 +4013,15 @@ public class Editor {
@Override
public void updatePosition(float x, float y) {
positionAtCursorOffset(mTextView.getOffsetForPosition(x, y), false);
Layout layout = mTextView.getLayout();
int offset;
if (layout != null) {
int currLine = getCurrentLineAdjustedForSlop(layout, mPrevLine, y);
offset = mTextView.getOffsetAtCoordinate(currLine, x);
} else {
offset = mTextView.getOffsetForPosition(x, y);
}
positionAtCursorOffset(offset, false);
if (mTextActionMode != null) {
mTextActionMode.invalidate();
}