Repository navigation
feat(native): expose programmatic text selection - #430
Closed
tiensonqin wants to merge 2 commits into
Closed
tiensonqin wants to merge 2 commits into
tiensonqin wants to merge 2 commits into
Conversation
Lui_window.Ui.set_selection focuses a node when needed and places the editable selection at byte offsets, the native counterpart of the DOM's setSelectionRange, so hosts no longer need to emulate select-all through the primary-modifier+A accelerator. Offsets clamp to the text length and round back to UTF-8 sequence starts.
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
set_selection now returns actions carrying Focus_changed when it focuses the node, so drivers start text input and update accessibility focus; the interface documents that hosts should sync the store first, and the migration guide gains a concrete select-all example.
Contributor
There was a problem hiding this comment.
Devin Review found 2 findings. Devin automatically fixed all 2 findings.
Fixed by Devin (2)
- Selection focus bypasses native text input — Fixed in 6b657b2: set_selection now returns actions carrying Focus_changed when the focus moves, so drivers start text input and update accessibility focus exactly like keyboard/pointer focus paths.
- Missing select-all migration example — Fixed in 6b657b2: docs/api-migrations.md now includes a concrete select-all migration example replacing the accelerator hack.
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.
Summary
Lui_window.Ui.set_selection ui store id ~anchor ~caret— the native counterpart of the DOM'ssetSelectionRange. Until now the interaction machines exposed no way to place the editable selection programmatically, so hosts emulated select-all by synthesizing a primary-modifier+A keydown and could not represent any other range.idwhen it is not focused (reusing the ordinaryfocus_moveattach path), then sets the session selection to[min anchor caret .. max anchor caret)via the existingLui_text_input.set_caretmachinery.Lui_query.clamp_boundary— the browser's clamping semantics applied to UTF-8 storage.Recorded in
docs/api-migrations.md. Regression coverage:programmatic set_selectioninlui_window_testverifies mid-range replacement typing, out-of-range clamping and UTF-8 boundary rounding without mocks.Link to Devin session: https://app.devin.ai/sessions/c5d7e54b078e47e28153404536bb3def
Open in Devin Desktop: https://app.devin.ai/desktop/session/c5d7e54b078e47e28153404536bb3def?variant=devin
Requested by: @tiensonqin
🟢 Devin fixed all 2 findings · Follow Devin's work