feat(rust-lite): mirror the editor word and line keys - #46
Merged
Conversation
Port `src/edit-keys.ts` to `rust/src/edit_keys.rs` so the native editor moves and kills by the same boundaries as the Bun runtime: Option/Alt and Ctrl arrows plus Alt+B/Alt+F move by word, Command/Super arrows and Ctrl+A/Ctrl+E move to the line edges, and Ctrl+W, Alt+Backspace, and Ctrl+U kill back to a word or line start. Word boundaries use JavaScript's `\s` class, cross a newline one step at a time, and treat a CJK run as one word. Add `screen.editor.word-line-moves` and `screen.editor.word-line-kills` to the parity harness, which send the raw byte sequence for every new key and type a marker after each move, and record the result in both parity documents. refs #38
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.
Brings the native Rust Lite editor to parity with the Bun editor's word and line keys from #34: Option/Alt and Ctrl arrows move by word, Command arrows move to line edges, Alt+b/f word moves, Ctrl+A/E line moves, Ctrl+W and Alt+Backspace delete a word, Ctrl+U deletes to line start. Newline crossing and CJK word runs match the Bun helpers, and the JavaScript whitespace class is spelled out so U+0085 and U+FEFF behave identically.
Crossterm decodes xterm modifier 9 as SUPER only, so line moves are gated on SUPER; Node folds modifiers 3 and 9 into one flag and reads the raw sequence. All thirteen sequences resolve to the same action on both sides.
Parity: two new PTY cases (moves and kills) with store-byte comparison; 510 -> 622 observables, zero divergences. Negative controls on two helpers produce 21 and 17 divergences. Live: both runtimes saved
alpha Xfor the same keystrokes inside Herdr; smoke-rust-lite and smoke both 0 failures.Closes #38