Repository navigation
Conversation
With text selected in the book reader, Shift+arrows move the selection's focus end as in a text editor, the anchor end staying fixed: - Shift+Left/Right: one character (a letter with its nikud/teamim) - Ctrl+Shift+Left/Right: one word - Shift+Up/Down: one visual line, keeping a goal column across a run Left/Right follow the screen: in a right-to-left (Hebrew) line Left moves toward the end of the text and Right toward its start; in a left-to-right line the reverse. The direction is taken from the focus's line, from its own text. Only an existing selection (a drag, a double click, a Shift+click) is adjusted: without one, plain and Shift arrows keep scrolling/moving by line as before, and Ctrl+Alt/Meta combinations stay the window's. Signed-off-by: Chagai Yisroel Wild <wildhagai@puzzlesoft.co.il> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What
With text selected in the book reader, Shift+arrows fine-tune the selection like a text editor. The anchor end stays fixed and only the focus end moves.
Key bindings
RTL behavior
The arrows follow the screen. In a right-to-left (Hebrew) line, Left moves toward the end of the text (the next letter, which sits to its left) and Right toward the start. In a left-to-right line it is the reverse. The direction comes from each line's own text, so books that mix Hebrew and Latin lines feel natural in both. Within a line, moves follow the order of the text, as a text editor's cursor does across a short run in the other direction. This is documented in
towardsEndinSelectionMotion.kt.Implementation
SelectionMotion.kt(new): the character, word and visual-line moves, and the Shift+arrow handler.BookSelection.kt: the selection now keeps an anchor and a focus. It also records the layout and position of each line on screen, hides Compose's own highlight under the reader's selection, and makes Ctrl+C wait briefly for a selection the keys just moved.BookContentView.kt: the Shift+arrow handler runs before the plain arrow handling, and the view scrolls to keep the focus visible.BookContentScreen.kt: after a run of key presses, the selected text is looked up once the keys pause for 80 ms instead of on every press.Tests
SelectionMotionTest(new): direction, characters with nikud, words and abbreviations, crossing lines, visual lines.BookSelectionTest: anchor and focus, starting from each kind of selection, no selection after a plain click.ShiftArrowSelectionUiTest(new): the keys move the focus in Hebrew text, and arrows are left to the view when nothing is selected.ShiftClickSelectionUiTest,UnplacedSelectionUiTest,LineSelectionIntegrationTest,BookContentKeyboardUiTest) still pass. 60 tests pass in all, andktlintCheckis clean.🤖 Generated with Claude Code