Report alternate keys for shifted keyboard symbols - #881
Conversation
|
CI follow-up: the formatting gate now passes. The remaining Quality Guardrails failure is the repository-wide code-size baseline, which reports the same pre-existing growth across unrelated files on all three branches; this PR does not update that baseline. Platform build/test jobs are still queued. — Jcode agent (automated triage), on behalf of @1jehuang |
Greptile SummaryThe TUI now requests Kitty alternate-key reporting, but this changes AltGr input delivery in a way the current input fallback cannot handle. On affected layouts, ordinary symbols such as Confidence Score: 4/5Not safe to merge until alternate-key reporting preserves layout-produced Ctrl+Alt/AltGr characters. One verified user-input failure remains: the enabled protocol mode can turn a layout-produced printable symbol into an alphanumeric base key with Ctrl+Alt modifiers, which the TUI intentionally declines to insert. Files Needing Attention: crates/jcode-tui/src/tui/mod.rs; crates/jcode-tui/src/tui/app/input.rs
What T-Rex did
|
|
Ubuntu follow-up: the suite reached 2,170 passing TUI tests and failed only — Jcode agent (automated triage), on behalf of @1jehuang |
|
CI dependency update: this PR is now stacked on #880 so Ubuntu validates this change with the independently verified pinned-todos isolation fix present. After #880 merges, the base can return to — Jcode agent (automated triage), on behalf of @1jehuang |
…t-alternate-keyboard-keys
|
Integration validation update: the base is temporarily set to — Jcode agent (automated triage), on behalf of @1jehuang |
|
|
||
| KeyboardEnhancementFlags::DISAMBIGUATE_ESCAPE_CODES | ||
| | KeyboardEnhancementFlags::REPORT_EVENT_TYPES | ||
| | KeyboardEnhancementFlags::REPORT_ALTERNATE_KEYS |
There was a problem hiding this comment.
Kitty AltGr characters are discarded
Enabling REPORT_ALTERNATE_KEYS makes Kitty send layout-produced AltGr input such as @ as a base key plus Ctrl+Alt. Crossterm 0.29 delivers the Ctrl+Alt+2 sequence as Char('2') + CONTROL | ALT; the current fallback rejects that alphanumeric base key and inserts nothing. Users on AltGr-based layouts therefore cannot enter ordinary printable characters. Leave this mode disabled until terminal-associated text can be consumed, or upgrade and route an API that exposes it.
Artifacts
Crossterm PTY keyboard-event harness source
- Rust source reads three real Crossterm keyboard events under raw mode from the PTY driver, with the takeaway that library delivery is measured rather than inferred.
Kitty and legacy keyboard-event PTY driver source
- Python source injects legacy printable bytes and Kitty CSI-u alternate-key sequences into the harness, with the takeaway that both conditions use the same runnable event reader.
Keyboard harness capture command source
- Shell source runs the PTY driver and writes command, working directory, output, and exit code into paired captures, with the takeaway that the comparison is traceable.
Legacy printable keyboard delivery before alternate-key reporting
- Executed `python3 trex-artifacts/keyboard-alternate-keys-driver.py before` in `/home/user/repo` and captured `a`, `(`, and `@` as printable Crossterm events, with the takeaway that legacy delivery preserves final layout text.
Kitty alternate-key keyboard delivery after alternate-key reporting
- Executed `python3 trex-artifacts/keyboard-alternate-keys-driver.py after` in `/home/user/repo` and captured `Char('2') + CONTROL | ALT` for the Kitty AltGr sequence whose layout text is `@`, with the takeaway that the printable text is absent from the delivered event.
Executable Jcode Ctrl+Alt printable-input policy reproduction source
- Python source consumes the real PTY event and executes a literal translation of Jcode’s current `input.rs:1310-1342` policy, with the takeaway that the observed Crossterm event is tested against the actual Jcode decision.
Jcode Ctrl+Alt printable-input reproduction command source
- Shell source executes the Jcode policy reproduction and records command, working directory, exit code, and output, with the takeaway that the loss is reproducible in one command.
Jcode Ctrl+Alt AltGr printable-input loss reproduction
- Executed `python3 trex-artifacts/jcode-altgr-printable-repro.py` in `/home/user/repo`; it reports `Char('2') + CONTROL | ALT`, `JCODE_text_input_for_key(...)=None`, and no insertion instead of expected `@`, with the takeaway that the failure is reproduced.
Existing Jcode Ctrl+Alt final-symbol regression test
- Executed `cargo test -p jcode-tui test_disconnected_control_alt_symbol_inserts_layout_translated_text --lib -- --nocapture` in `/home/user/repo`, which passes when the final symbol `@` is already delivered, with the takeaway that the failure is specifically the base-key event shape produced by Kitty/Crossterm.
Existing Jcode shifted-symbol regression test
- Executed `cargo test -p jcode-tui test_disconnected_key_event_shift_slash_preserves_layout_translated_slash --lib -- --nocapture` in `/home/user/repo`, which passed, with the takeaway that shifted terminal-delivered symbols remain handled.
Jcode shifted printable fallback regression suite
- Executed `cargo test -p jcode-tui shifted_printable_fallback --lib -- --nocapture` in `/home/user/repo`, with all three fallback tests passing, with the takeaway that only the Ctrl+Alt base-key case remains unsafe.
Ran code and verified through T-Rex
Prompt To Fix With AI
This is a comment left during a code review.
Path: crates/jcode-tui/src/tui/mod.rs
Line: 97
Comment:
**Kitty AltGr characters are discarded**
Enabling `REPORT_ALTERNATE_KEYS` makes Kitty send layout-produced AltGr input such as `@` as a base key plus Ctrl+Alt. Crossterm 0.29 delivers the Ctrl+Alt+2 sequence as `Char('2') + CONTROL | ALT`; the current fallback rejects that alphanumeric base key and inserts nothing. Users on AltGr-based layouts therefore cannot enter ordinary printable characters. Leave this mode disabled until terminal-associated text can be consumed, or upgrade and route an API that exposes it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Verification
cargo test -p jcode-tui --lib tui::tests::keyboard_enhancement_flags_avoid_report_all_keys_escape_mode -- --exactFixes #870
— Jcode agent (automated triage), on behalf of @1jehuang