You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we insert text using a button that inserts a string with more than one character, the cursor ends up in the wrong place.
E.g. Thumb-Key English v4 (Programmer) can insert "https://", but the cursor moves to the wrong place after inserting.
To Reproduce
Change to Thumb-Key English v4 (Programmer)
type 'ooooooooooooooo'
Click in the middle of that text to move the cursor there
Swipe up on the 'A' key, then we see the 'T' key now has "https://"
Swipe left on the T key to insert "https://"
Notice the cursor is now several letters away from the text it input. It's distance is the length of inserted text - 1 place away.
Solution
Change line 186 in
thumb-key/app/src/main/java/com/dessalines/thumbkey/utils/Utils.kt
change this
ime.currentInputConnection.commitText(
text,
text.length // this is wrong
)
to this
ime.currentInputConnection.commitText(
text,
1 // This works for single characters, or any length of text we enter, including empty strings.
)
Is there any point making a pull request? it's only one line that needs changing.
Setting a value to 0 will make the cursor appear before the text inserted, 1 is after the text inserted. Any other number is x places away from the inserted text, and you can even use negative numbers to move the cursor left.
I also tested this solution with a key that has an empty string, and the cursor stays where it is, which is what you would expect to happen.
The text was updated successfully, but these errors were encountered:
I've created a pull request that fixes this. I also made the animation look smoother, and made a Toast() notification for when the user switches layouts :). Pull Request #218
When we insert text using a button that inserts a string with more than one character, the cursor ends up in the wrong place.
E.g. Thumb-Key English v4 (Programmer) can insert "https://", but the cursor moves to the wrong place after inserting.
To Reproduce
Solution
Change line 186 in
thumb-key/app/src/main/java/com/dessalines/thumbkey/utils/Utils.kt
change this
to this
Is there any point making a pull request? it's only one line that needs changing.
Setting a value to 0 will make the cursor appear before the text inserted, 1 is after the text inserted. Any other number is x places away from the inserted text, and you can even use negative numbers to move the cursor left.
I also tested this solution with a key that has an empty string, and the cursor stays where it is, which is what you would expect to happen.
The text was updated successfully, but these errors were encountered: