bring back elvis he never hurt nobody

This commit is contained in:
devycarol 2025-03-06 23:43:38 -07:00
parent 32a21092d3
commit fed79abe26

View file

@ -117,16 +117,14 @@ class KeyboardActionListenerImpl(private val latinIME: LatinIME, private val inp
var actualSteps = 0
// corrected steps to avoid splitting chars belonging to the same codepoint
if (steps > 0) {
val text = connection.getSelectedText(0)
if (text == null) actualSteps = steps
else loopOverCodePoints(text) { cp, charCount ->
val text = connection.getSelectedText(0) ?: return steps
loopOverCodePoints(text) { cp, charCount ->
actualSteps += charCount
if (actualSteps >= steps) return actualSteps
}
} else {
val text = connection.getTextBeforeCursor(-steps * 4, 0)
if (text == null) actualSteps = steps
else loopOverCodePointsBackwards(text) { cp, charCount ->
val text = connection.getTextBeforeCursor(-steps * 4, 0) ?: return steps
loopOverCodePointsBackwards(text) { cp, charCount ->
actualSteps -= charCount
if (actualSteps <= steps) return actualSteps
}