Repository navigation
fix(cursor): stop space swipe at the edge of the text (#891) - #895
Merged
Merged
Conversation
Space swipe sends one arrow key per step. At the edge of the text the app moves the focus to another field instead, so the cursor jumped out of the field. The swipe now stops at the start and end of the text, for horizontal and vertical swipes. The text before the cursor is asked from the editor, as arrow keys don't update the cached text and cursor position.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part 2 of #891: when swiping the space bar to move the cursor, the cursor left the field at the end of the text and jumped to the next field (or somewhere else).
Cause: since the space swipe was switched to arrow key events, every step sends one arrow key. At the edge of the text there is nowhere to move, so the app handles the arrow key as focus navigation and moves to another field.
Fix:
RichInputConnection.getTextBeforeCursorFromEditor), because arrow keys don't update the cached text and expected cursor position. If the editor gives no answer, the swipe moves as before.Tested:
assembleStandardDebug; on a phone in Brave with two text fields, swiping left and right moves the cursor to the start and end of the first field and stays there (focus no longer moves to the second field).Not tested: vertical swipe, native text fields, the touchpad (its arrow keys can still leave the field, unchanged here).
Part 1 of #891 (two extra letters) is not addressed here, so the issue should stay open after merging.