Repository navigation
[CTX-0154] fix(input): synthesize Ctrl+letter bytes - #255
Merged
Merged
Conversation
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.
Closes #250. Task: CTX-0154.
Problem
encode_key_event(platform/keyboard.rs) used winittextverbatim, else the bare logical char - control state was never synthesized in the legacy path. On Wayland winit reports text=None (or the plain letter) for Ctrl+letter, so Ctrl+F sentf, Ctrl+C sentc. Runtime trackedcontrol_pressedvia modifier key events but the legacy encoder never consulted it.Fix (encoder side only)
encode_key_event_with_modifiers(event, modifiers)- Ctrl+A-Z => 0x01-0x1A (case-insensitive, from logical char + tracked control state, never winit text), Ctrl+Space/[/]/^/_/? => 0x00/ESC/0x1C/0x1D/0x1E/0x1F/0x7F (xterm &0x1F + ? special), unmapped Ctrl chords fall back to text (never swallowed); Alt => ESC-prefix (metaSendsEscape, incl. Ctrl+Alt => ESC+C0); named Space+Ctrl => NUL.encode_key_eventkept as the no-modifier wrapper (parity proven by test, no caller breakage).modifier_snapshot()from tracked shift/control/alt;encode_key_with_kittylegacy fallbacks (kitty off + non-disambiguated) now honor it, sohandle_key_eventsynthesizes C0 live. PureRuntime::encode_key_eventunchanged.Coordination need for CTX-0153 (#249, keymaps - out of scope, NOT touched)
Double handling confirmed code-level: main.rs
handle_eventroutes KeyboardInput toruntime.handle_platform_event(PTY bytes) AND the app focus matcher then consumes Tab/n/p/arrows/1-8 with no modifier check and no suppression. So Ctrl+P will write 0x10 to the PTY and also move focus to Prev. Single-owner-per-event must be decided on the #249 side (e.g. keymap/focus consumes => skip PTY routing, and/or require no-Ctrl for focus keys).Validation
Remaining risks
Priority: P0 | Area: input | Labels: fix,area:input,P0 | Milestone: v0.1.0 | RFC: - | Task: CTX-0154