@@ -26,15 +26,12 @@ object EnhancedMovementMethod : ArrowKeyMovementMethod() {
2626 x + = widget.scrollX
2727 y + = widget.scrollY
2828
29+ if (x < 0 ) return true
30+
2931 val layout = widget.layout
3032 val line = layout.getLineForVertical(y)
3133 val off = layout.getOffsetForHorizontal(line, x.toFloat())
3234
33- val clickedSpanBordersAnotherOne = (text.getSpans(off, off, AztecMediaClickableSpan ::class .java).size == 1 &&
34- text.getSpans(off + 1 , off + 1 , AztecMediaClickableSpan ::class .java).isNotEmpty())
35-
36- val isClickedSpanAmbiguous = text.getSpans(off, off, AztecMediaClickableSpan ::class .java).size > 1
37-
3835 // get the character's position. This may be the left or the right edge of the character so, find the
3936 // other edge by inspecting nearby characters (if they exist)
4037 val charX = layout.getPrimaryHorizontal(off)
@@ -50,6 +47,11 @@ object EnhancedMovementMethod : ArrowKeyMovementMethod() {
5047
5148 val clickedOnSpan = clickedWithinLineHeight && (clickedOnSpanToTheLeftOfCursor || clickedOnSpanToTheRightOfCursor)
5249
50+ val clickedSpanBordersAnotherOne = (text.getSpans(off, off, ClickableSpan ::class .java).size == 1 &&
51+ text.getSpans(off + 1 , off + 1 , ClickableSpan ::class .java).isNotEmpty())
52+
53+ val isClickedSpanAmbiguous = text.getSpans(off, off, ClickableSpan ::class .java).size > 1
54+
5355 val failedToPinpointClickedSpan = (isClickedSpanAmbiguous || clickedSpanBordersAnotherOne)
5456 && ! clickedOnSpanToTheLeftOfCursor && ! clickedOnSpanToTheRightOfCursor
5557
0 commit comments