Repository navigation
Conversation
…nd JS's no-DOM-selection deletion ## Description The Rust conformance runner didn't replay `property/sequences`, the 81 random command sequences JS records on a rich-text editor with lists, check lists, links, hashtags, code and history. It does now. The suite builds the editor `sequenceEditor` builds, in the extension builder's registration order: `InitialStateExtension`'s first update included, and no `registerCodeIndentation`, since only `CodeIndentExtension` registers it. Two Rust differences from JS showed up, and both are fixed: - `NormalizeInlineElementsExtension`'s registration (`deleteEmptyInline`, which `RichTextExtension` depends on) wasn't ported, so empty links and autolinks stayed. It is now `register_normalize_inline_elements`, behind the `extension` feature. - In that editor, JS's `getDOMSelection` returns null, so `$extendSelectionForDeletion` and `modify` stop after their model step. Rust kept measuring and moved the selection into nearby text. A new `SelectionMovement::has_dom_selection()` (default true) lets an app say there is no DOM selection. ## Test plan ### Before ``` $ cargo run -q --release -p lexical-conformance | grep -E 'sequences|Total' | `property/sequences` | – | – | – | – | – | not implemented | | **Total** | 488 | 488 | 0 | 0 | 0 | | ``` ### After ``` $ cargo run -q --release -p lexical-conformance | grep -E 'sequences|Total' | `property/sequences` | 81 | 81 | 0 | 0 | 0 | pass | | **Total** | 569 | 569 | 0 | 0 | 0 | | $ cargo test --workspace --all-features 38 passed, 0 failed ``` Mutations, each restored afterwards: `delete_empty_inline` removing nothing fails 19 cases; the early return in `extend_selection_for_deletion` disabled fails 6; `FORMAT_TEXT_COMMAND` formatting nothing fails 15. `doctored_sequences_fail` checks that a vector with one `handled` and one `text` changed fails exactly those steps. `cargo fmt --check`, clippy `-D warnings`, rustdoc `-D warnings`, `cargo +1.88 check`, `--no-default-features` and Rune's clippy pass. Amp-Thread-ID: https://ampcode.com/threads/T-16d45229-bfa8-417a-a091-d3e3888d830d
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.
Description
The Rust conformance runner didn't replay
property/sequences, the 81random command sequences JS records on a rich-text editor with lists,
check lists, links, hashtags, code and history.
It does now. The suite builds the editor
sequenceEditorbuilds, in theextension builder's registration order:
InitialStateExtension's firstupdate included, and no
registerCodeIndentation, since onlyCodeIndentExtensionregisters it.Two Rust differences from JS showed up, and both are fixed:
NormalizeInlineElementsExtension's registration (deleteEmptyInline,which
RichTextExtensiondepends on) wasn't ported, so empty links andautolinks stayed. It is now
register_normalize_inline_elements, behindthe
extensionfeature.getDOMSelectionreturns null, so$extendSelectionForDeletionandmodifystop after their model step.Rust kept measuring and moved the selection into nearby text. A new
SelectionMovement::has_dom_selection()(default true) lets an app saythere is no DOM selection.
Test plan
Before
After
Mutations, each restored afterwards:
delete_empty_inlineremovingnothing fails 19 cases; the early return in
extend_selection_for_deletiondisabled fails 6;FORMAT_TEXT_COMMANDformatting nothing fails 15.
doctored_sequences_failchecks that avector with one
handledand onetextchanged fails exactly thosesteps.
cargo fmt --check, clippy-D warnings, rustdoc-D warnings,cargo +1.88 check,--no-default-featuresand Rune's clippy pass.Stacked on #146.