Repository navigation
fix: prevent Japanese IME confirmation Enter from executing command - #2075
lawrencecchen merged 2 commits into
Conversation
Korean IME commits a syllable and executes on a single Enter, but Japanese/Chinese IME use Enter only to confirm conversion — a second Enter is needed to execute. Restrict the extra Return forwarding in shouldSendCommittedIMEConfirmKey to Korean input sources only.
|
@rerun0510 is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughRestricts synthesized "extra Return" behavior to Korean IMEs by gating commit-key logic on the current input source ID; adds a DEBUG-only KeyboardLayout override for tests and updates a regression test to use that override. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR fixes a bug where pressing Enter during Japanese (and Chinese) IME text confirmation would also trigger command execution, by restricting the extra Return forwarding in Key changes:
The fix is minimal, targeted, and well-tested for the Korean positive case. A negative test for Japanese/Chinese (verifying the extra Return is not sent) would further strengthen coverage. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[keyDown: Enter / Return] --> B{markedTextBefore\nAND markedText.length == 0?}
B -- No --> C[Skip extra Return]
B -- Yes --> D{keyCode == 36\nor 76?}
D -- No --> C
D -- Yes --> E{KeyboardLayout.id\navailable?}
E -- No --> C
E -- Yes --> F{sourceId contains\n'korean' case-insensitive?}
F -- No\nJapanese / Chinese / other --> C[No extra Return sent\nUser must press Enter again to execute]
F -- Yes\nKorean --> G[Send extra Return to Ghostty\nCommand executes in one step]
Reviews (2): Last reviewed commit: "refactor: use case-insensitive check for..." | Re-trigger Greptile |
|
@greptile-apps review |
|
Hi @lawrencecchen , |
|
Thank you for the contribution! |
…anaflow-ai#2075) * fix: prevent Japanese IME confirmation Enter from executing command Korean IME commits a syllable and executes on a single Enter, but Japanese/Chinese IME use Enter only to confirm conversion — a second Enter is needed to execute. Restrict the extra Return forwarding in shouldSendCommittedIMEConfirmKey to Korean input sources only. * refactor: use case-insensitive check for Korean input source ID
Summary
What changed
Sources/GhosttyTerminalView.swiftshouldSendCommittedIMEConfirmKeynow checksKeyboardLayout.idand only sends the extra Return for Korean input sourcesSources/KeyboardLayout.swiftdebugInputSourceIdOverride(DEBUG only) to allow tests to simulate specific input sourcescmuxTests/CJKIMEInputTests.swiftIME behavior difference
Testing
testReturnAfterKoreanCommitAlsoSendsReturnToSurface) passes.reload.sh --tag fix-jp-ime.Demo Video
v0.62.2 (before the bug occurred)
2026-03-25.11.11.05.mov
Before the fix (latest main branch)
2026-03-25.11.23.07.mov
After the fix
2026-03-25.12.57.50.mov
Summary by cubic
Fixes Enter with Japanese/Chinese IME so it only confirms conversion and does not execute the command; Korean IME behavior (confirm + execute in one Enter) remains unchanged.
shouldSendCommittedIMEConfirmKeyto Korean input sources only, using a case-insensitive ID check.debugInputSourceIdOverride(DEBUG-only) toKeyboardLayoutand update the Korean IME unit test to use it.Written for commit d74afef. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests