-
Notifications
You must be signed in to change notification settings - Fork 731
change IME composing handling order to support implicitly confirming IME #2767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe change reworks IME input handling in TermWrap.handleTermData by replacing an early composition block with a time-windowed deduplication mechanism. A 50-millisecond dedup window now permits the first data after composition ends, even if a new composition has started, while blocking duplicate inputs from the same window (such as from Capslock or input method switches). An additional guard was added to explicitly prevent intermediate composition updates from being transmitted to the terminal handler. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
frontend/app/view/term/termwrap.ts (1)
625-652: IME dedup logic works for desktop but lacks mobile/iOS fallback for Hangul composition events.The 50ms dedup window is appropriate for desktop CJK IMEs (Pinyin, Japanese), though timing varies across implementations. However, a critical gap exists: iOS and other mobile platforms do not emit composition events for Hangul/Korean input—instead, input arrives via
beforeinputevents. The current implementation will silently fail to handle Korean input on iOS.To address this:
Add
beforeinputfallback handling for platforms where composition events don't fire. Detect IME input viainputTypevalues (e.g.,"insertCompositionText") and use that as a fallback to capture Korean input on mobile.Extract
IMEDedupWindowMsas a class-level constant for visibility and future configurability.Test across platforms and IME implementations: Pinyin, Japanese (Mozc/Anthy), Hangul on desktop (Chrome, Firefox, Safari) and mobile (iOS Safari, Android Chrome).
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
frontend/app/view/term/termwrap.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: merge-gatekeeper
🔇 Additional comments (1)
frontend/app/view/term/termwrap.ts (1)
654-661: LGTM - Guard placement is correct.Placing this guard after the dedup check ensures that:
- Confirmed text from a recent compositionend is allowed through (even if a new composition has started)
- Intermediate composition updates during active composition are blocked
The logic flow is sound.
|
thanks for submitting this and thanks for the videos. I'm not a native IME user, so it can be hard to track down and fix bugs like these. I'll try to get this reviewed and hopefully merged for the next release. |
Problem
When using IME with Japanese in the terminal panel, implicitly confirming IME does not work properly.
Environment
Step to reproduce
てすとテストあてすとテストand continue with next chars compositionテストis lost, only next chars composition continuesCause
I added some logs and check the behavior, the event triggering order seems complicated.
DEMO
current.mp4
updated.mp4
reference.mp4
Note
I'm not familiar with other CJK languages and IME itself. There may be patterns I'm unaware of.