优化
This commit is contained in:
@@ -454,13 +454,15 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun compare(pos: Pos): Int {
|
fun compare(pos: Pos): Int {
|
||||||
if (relativePos < pos.relativePos) return -3
|
return when {
|
||||||
if (relativePos > pos.relativePos) return 3
|
relativePos < pos.relativePos -> -3
|
||||||
if (lineIndex < pos.lineIndex) return -2
|
relativePos > pos.relativePos -> 3
|
||||||
if (lineIndex > pos.lineIndex) return 2
|
lineIndex < pos.lineIndex -> -2
|
||||||
if (charIndex < pos.charIndex) return -1
|
lineIndex > pos.lineIndex -> 2
|
||||||
if (charIndex > pos.charIndex) return 1
|
charIndex < pos.charIndex -> -1
|
||||||
return 0
|
charIndex > pos.charIndex -> 1
|
||||||
|
else -> 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user