am 7fac4d6c: am 1c277ca8: Merge "Fix: line slop shouldn\'t always increase / decrease by one line" into mnc-dev

* commit '7fac4d6cc41cab81b2b2202725ae69782f9bcce9':
  Fix: line slop shouldn't always increase / decrease by one line
This commit is contained in:
Mady Mellor
2015-07-13 23:33:26 +00:00
committed by Android Git Automerger

View File

@@ -4438,10 +4438,16 @@ public class Editor {
}
private int getCurrentLineAdjustedForSlop(Layout layout, int prevLine, float y) {
final int trueLine = mTextView.getLineAtCoordinate(y);
if (layout == null || prevLine > layout.getLineCount()
|| layout.getLineCount() <= 0 || prevLine < 0) {
// Invalid parameters, just return whatever line is at y.
return mTextView.getLineAtCoordinate(y);
return trueLine;
}
if (Math.abs(trueLine - prevLine) >= 2) {
// Only stick to lines if we're within a line of the previous selection.
return trueLine;
}
final float verticalOffset = mTextView.viewportToContentVerticalOffset();