Skip to content

Run Ctrl/Alt/Cmd shortcuts on the Korean input source - #1727

Closed
mg-mg-mg wants to merge 4 commits into
1jehuang:masterfrom
mg-mg-mg:fix/korean-layout-shortcuts
Closed

mg-mg-mg wants to merge 4 commits into
1jehuang:masterfrom
mg-mg-mg:fix/korean-layout-shortcuts

Conversation

@mg-mg-mg

@mg-mg-mg mg-mg-mg commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1738

Problem

With macOS Korean 2-Set active, terminal key events for Jcode-owned modified shortcuts can carry jamo rather than Latin letters, such as Ctrl+ㅏ instead of Ctrl+K or Cmd+ㅠ instead of Cmd+B. Shortcut dispatch misses those events. Terminal-owned actions such as Ghostty Cmd+V need the terminal physical-key binding and are outside this PR.

Fix

Normalize only Korean 2-Set jamo with Ctrl, Alt, Super, Meta, or Hyper to the Latin letter on the same key before Jcode shortcut and voice dispatch. Keep plain Korean input unchanged. The map and normalizer now live together in jcode-tui-core::korean_input, shared by local, remote, disconnected and picker paths. Existing oversized dispatch files remain within the repository code-size budget without raising its baseline.

Verification

  • Korean mapping, Ctrl shortcut, Cmd chord, plain typing, voice chord and existing Korean Undo regression tests passed.
  • cargo clippy -p jcode-tui -p jcode-tui-core --all-targets -- -D warnings passed.
  • cargo fmt --package jcode-tui-core --package jcode-tui -- --check and scripts/check_code_size_budget.py passed.
  • Previous full package run at 87357f4: 2465 passed, 2 failed. Shimmer color reproduces on its base e46eff2, and legacy reload passes 3/3 in isolation but races on a shared file in parallel. Full suite has not been rerun after extraction.

No installed Jcode sessions were changed. No upstream merge requested.

…t jamo to the physical letter

With the Korean (2-Set) input source active, terminals report Ctrl+K as Ctrl+ㅏ and Cmd+B as Cmd+ㅠ, so every letter keybinding (readline edits, Cmd+B resume, configured chords) silently missed and Cmd chords neither fired nor typed. All key entry points (local, disconnected, remote, scroll-key probe) now fold a jamo under a Ctrl/Alt/Cmd/Meta/Hyper chord to the US-QWERTY letter on the same physical key; plain jamo typing is untouched.

Tested: cargo test -p jcode-tui-core dubeolsik (1 passed); cargo test -p jcode-tui korean_jamo (3 passed; 2 fail with the fold removed); cargo test -p jcode-tui -p jcode-tui-core: 2465 passed, 2 failed (test_prompt_entry_shimmer_color_moves_across_positions also fails on base e46eff2; test_restore_reload_state_supports_legacy_input_format passes 3/3 in isolation, a shared-file parallel flake); cargo clippy -p jcode-tui -p jcode-tui-core --all-targets -D warnings exit 0
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium risk] Adds Korean keyboard input normalization to keyboard handling.

No outstanding findings block merging.

Summary

The PR normalizes modified Korean 2-Set keys before shortcut and voice-key handling. It also adds tests for connected and disconnected remote input paths.

Reviews (4) · Last reviewed commit: "Cover Korean shortcuts in remote termina..."

Greptile review on 1jehuang#1727: voice shortcut interception ran on the raw key before the per-handler Hangul fallback, so Ctrl+ㅠ never started or released voice recording. Normalize the KeyEvent once where each loop reads it (local, remote connected/disconnected, turn loops, session picker) and drop the per-handler fallbacks. Tests drive the normalized event path.
@mg-mg-mg

mg-mg-mg commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both review points in 87357f4:

  • P1 voice chords: normalization moved to the key read site of every event loop (local, remote connected + disconnected, the three turn loops, session picker), so voice interception and its release check see Ctrl+b for a Korean-layout Ctrl+ㅠ. Per-handler fallbacks removed, so there is one normalization point.
  • P2 coverage: shortcut tests now go through normalize_key_event + handle_key_press_event, plus a voice-chord normalization test.

cargo test -p jcode-tui -p jcode-tui-core: new failures vs base none (test_prompt_entry_shimmer_color_moves_across_positions fails on base too; other failures vary run-to-run and pass in isolation). clippy -D warnings clean.

Move the two-set chord normalization to tui-core so terminal entry points share one implementation, and flatten existing dispatch branches rather than enlarging oversized files.

Tested: cargo test -p jcode-tui-core korean_input; cargo test -p jcode-tui korean_jamo --lib; cargo test -p jcode-tui korean_typing --lib; cargo clippy -p jcode-tui -p jcode-tui-core --all-targets -- -D warnings; cargo fmt --package jcode-tui-core --package jcode-tui -- --check; python3 scripts/check_code_size_budget.py; git diff --check (all passed)
@mg-mg-mg

mg-mg-mg commented Oct 6, 2026

Copy link
Copy Markdown
Contributor Author

CI follow-up at head f93a1de: Require Linked Issue is now green after linking #1738, and the focused Korean input tests, clippy and code-size ratchet pass on this PR branch. The current CI Format and Quality Guardrails jobs fail at cargo fmt --all -- --check on src/cli/commands_tests.rs:287, a file added on upstream master after this PR branched. I reproduced that exact failure in a clean checkout of current upstream master a0c41dc, where scripts/check_code_size_budget.py independently also fails with 17 pre-existing entries (#692). Updating the stored baseline or formatting unrelated upstream code inside this keyboard fix would obscure ownership, so I have not folded those changes into this PR. The PR remains open for upstream CI repair; no merge has been attempted.

Exercise connected and disconnected handlers with a TestBackend, preserve plain jamo entry, and move local chord tests out of an oversized test file. Keep both repository size ratchets flat.

Tested: cargo test -p jcode-tui korean_input --lib (5 passed); cargo test -p jcode-tui voice_chord --lib (1 passed); cargo clippy -p jcode-tui -p jcode-tui-core --all-targets -- -D warnings; cargo fmt --all -- --check; scripts/check_module_files.py; scripts/check_test_size_budget.py; scripts/check_code_size_budget.py (all passed)
@1jehuang

Copy link
Copy Markdown
Owner

Thanks @mg-mg-mg! Squash-landed on master as a90e9b0 with your authorship (the intermediate commits conflicted, but the final tree merged cleanly). Korean, voice and turn-token tests pass, clippy -D warnings clean. --- Jcode agent, on behalf of @1jehuang

@1jehuang 1jehuang closed this Oct 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Korean 2-Set input source prevents Jcode modifier-letter shortcuts

2 participants