Conversation
- Prevent duplicate cursor movement by letting AppleStandardKeyBinding handle plain and Option arrow keys on macOS - Implement macOS Cmd+Arrow navigation (move/select to line start/end, document start/end) and Cmd+Backspace (delete to line start) - Add missing copy:, cut:, paste: handlers in apply_apple_standard_keybinding and prevent spurious Input event on copy - Fix typo in moveToEndOfDocumentAndModifySelection: selector
…lize key resolution - Add action_key helper in util.rs to prioritize physical key codes over layout-specific logical characters - Enable Cmd/Ctrl + A, C, V, X shortcuts on non-Latin and Korean keyboard layouts - Clean up shortcut matching with concise match pattern in TextInputData::apply_keypress_event and handle_key_or_input_event
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.
Fixes #894.
Summary
This PR addresses several macOS keyboard navigation, shortcut, and clipboard issues in
blitz-domtext inputs by adopting the pattern used in VS Code and Zed's editor architecture:Prevent 2-character jumping on plain arrow keys:
winitemits bothAppleStandardKeyBindingand rawKeyPress.apply_keypress_event, plain/Option navigation keys are left toAppleStandardKeyBindingso that AppKit can handle them natively (moveLeft:,moveWordLeft:) without duplicate execution.Support macOS
Cmd + Arrownavigation andCmd + Backspace:interpretKeyEvents:treatsCmdkeys as application commands and does not emit standard text selectors for them.Cmd + Left/Right(move to line start/end),Cmd + Up/Down(move to document start/end), theirShiftselection variants, andCmd + Backspace(delete to line start) directly inapply_keypress_event.Support clipboard operations in
AppleStandardKeyBinding:"copy:","cut:", and"paste:"inapply_apple_standard_keybinding.Inputevents when performing copy.Fix selector typo:
"moveToEndOfDocumentAndModifySelection:"callingdriver.move_to_text_end()instead ofdriver.select_to_text_end().Physical key (
Code) mapping for action shortcuts across non-Latin keyboard layouts:Key::Character("a" | "c" | "v" | "x"). On non-Latin keyboard layouts (e.g. Korean 2-Set where physicalKeyCgeneratesㅊ), shortcuts failed completely.action_keyhelper inutil.rsto normalize action keystrokes (Cmdon macOS,Ctrlon others) by prioritizing physical key codes (Code::KeyA,KeyC,KeyV,KeyX,KeyZ) with character fallback.TextInputData::apply_keypress_eventandhandle_key_or_input_eventusing a concisematch action_key(&event)pattern.Testing
cargo fmt --all --check: Passed.cargo clippy -p blitz-dom -- -D warnings: Passed (0 warnings).cargo test -p blitz-dom: 56/56 unit tests passed.wgpu_texturetext input across all combinations:Option + Arrow(word jump)Cmd + Arrow(line start/end, document start/end)Shiftmodifier combinations for all the above (selection)Cmd + Backspace(delete to line start)Cmd + C/Cmd + V/Cmd + X/Cmd + Aon both English and non-Latin (Korean) layoutsWPT results
No changes in test results compared to
main.Generated by the WPT workflow.