Repository navigation
fix: correct logical keys, cleared text edits, and highlight ranges - #106
Open
leoafarias wants to merge 2 commits into
Open
leoafarias wants to merge 2 commits into
leoafarias wants to merge 2 commits into
Conversation
Give one Unicode scalar a direct logical-key id so distinct emoji do not compare equal, ignore text edits and cursor movement while the selection is cleared, and reject reversed TextHighlight ranges in release mode. Co-authored-by: Leo Farias <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The const assert rejects the same ranges, so an in-process test cannot reach the release check. Keep the ArgumentError in RenderParagraph. Co-authored-by: Leo Farias <[email protected]>
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.
LogicalKeyboardKey.forCharacter
Non-BMP characters were folded through a 29-bit hash, so U+1F600 and U+1F9E1 compared equal and a
Shortcutstrigger could match the wrong key.Repro:
packages/noir/test/core/logical_keyboard_key_test.dart. It failed on the hashed id (0x200000000 + 0x1b0d63for both emoji) and on two multi-scalar strings that share that hash.Fix: one Unicode scalar uses
0x200000000 + scalar, above the named-key range.==andhashCodeincludekeyLabel, so a multi-scalar string is identified by its text as well as the hashed id.Lines:
input.dart+19/−3, test +28/−0.TextEditingController
A fresh controller’s selection is
collapsed(-1).insertanddeleteForwardthrewRangeError,deleteBackreturned false, andmoveCursorRightskipped offset 0.Repro:
packages/noir/test/foundation/text_editing_controller_test.dart. It failed withRangeErrorfromString.replaceRange.Fix: edits return false and movement returns until
selectionWithinText.Lines:
text_editing_controller.dart+11/−0, test +31/−0.TextHighlight
The range check was only an
assert, so release mode accepted a reversed or negative span.Fix:
RenderParagraph’s constructor and setter call_validatedSelection, which throwsArgumentError. The const assert stays.No test. Every invalid range throws from that assert before the setter can see it, and the release-only path needed a subprocess probe. That probe is removed.
Lines:
paragraph.dart+19/−3.