mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-20 14:19:08 +00:00
bring back elvis he never hurt nobody
This commit is contained in:
parent
32a21092d3
commit
fed79abe26
1 changed files with 4 additions and 6 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue