Fix Korean IME jamo leak during composition - #2529
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdded DEBUG-only timing instrumentation around Ghostty key sends, prevented fallback text sends when a key event is marked composing, and added a Korean IME regression test ensuring jamo are not leaked while marked text is active. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 Korean IME (Hangul) jamo leak during composition in the terminal surface. When composing with the Korean 2-Set IME, the Key changes:
Confidence Score: 4/5Safe to merge; the fix is narrowly scoped to the composing fallback path and is backed by a regression test. The logic change is minimal and well-isolated: one new boolean ( No files require special attention beyond the minor test variable naming noted in the comment. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[keyDown event received] --> B{accumulatedText empty?}
B -- No --> C[Send accumulated insertText results\ncomposing=false, text=committed string]
B -- Yes --> D[Compute suppressors]
D --> E{textForKeyEvent returns text?}
E -- No --> F[Send key\ntext=nil, consumed_mods=NONE]
E -- Yes --> G{shouldSendText AND\n!suppressShiftSpace AND\n!suppressComposing?}
G -- No\n'composing=true OR shift+space OR non-text key' --> F
G -- Yes --> H[Send key\ntext=committed jamo/char]
C --> I[ghostty_surface_key]
F --> I
H --> I
Reviews (1): Last reviewed commit: "fix: suppress fallback text during IME c..." | Re-trigger Greptile |
| guard let leakedEvent else { | ||
| XCTFail("Expected terminal key event for composing Hangul input") | ||
| return | ||
| } |
There was a problem hiding this comment.
Confusing variable name and guard failure message
leakedEvent is named as if capturing a bad/leaked event, but it actually holds the forwarded composing key event that is expected to arrive (the "leak" being tested is text ≠ nil, not the event itself). The XCTFail message at the guard makes this especially easy to misread: if the test fails here a developer sees "Expected terminal key event for composing Hangul input" and may think the intent was not to send an event, when in fact the guard asserts the opposite.
Consider renaming to make the intent clearer:
| guard let leakedEvent else { | |
| XCTFail("Expected terminal key event for composing Hangul input") | |
| return | |
| } | |
| guard let capturedEvent = leakedEvent else { | |
| XCTFail( | |
| "Expected a composing key event to be forwarded to Ghostty (with text=nil); no event was received" | |
| ) | |
| return | |
| } |
And update the subsequent leakedEvent references to capturedEvent.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Renamed the test variable to capturedEvent and clarified the failure message so the intent is explicit: Ghostty should still receive a composing key event, just with text=nil.
— Claude Code
Summary
Testing
Fixes #2519
Summary by cubic
Prevents Korean IME jamo from leaking into the terminal during composition by suppressing fallback text until the IME commits or cancels. Fixes #2519.
Bug Fixes
Refactors
sendTimedGhosttyKey(release usessendGhosttyKey) and rename timing metric paths to "*.total".Written for commit 1968d40. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests