Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2f30e890 authored by Mady Mellor's avatar Mady Mellor Committed by Android Git Automerger
Browse files

am 604b1138: am 8fe9a017: am 441ad4df: am 7fac4d6c: am 1c277ca8: Merge "Fix:...

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

* commit '604b1138':
  Fix: line slop shouldn't always increase / decrease by one line
parents 60ca9908 604b1138
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -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();