Skip to content

fix(cursor): stop space swipe at the edge of the text (#891) - #895

Merged
LeanBitLab merged 1 commit into
mainfrom
fix/space-swipe-field-edge
Nov 22, 2026
Merged

LeanBitLab merged 1 commit into
mainfrom
fix/space-swipe-field-edge

Conversation

@LeanBitLab

Copy link
Copy Markdown
Owner

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:

  • Horizontal space swipe: the number of steps is limited to the characters left before or after the cursor, so it stops at the start and end of the text.
  • Vertical space swipe: up at the start and down at the end of the text are no longer sent.
  • The text before the cursor is asked from the editor (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.

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.
@LeanBitLab
LeanBitLab merged commit 4048d3b into main Nov 22, 2026
1 check passed
@LeanBitLab
LeanBitLab deleted the fix/space-swipe-field-edge branch November 22, 2026 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant