Fix keyboard shortcuts not working with non-Latin IME (#1790) - #1791
Jaehui-Lee wants to merge 2 commits into
Conversation
|
@kakao-jacky-lee is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
|
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)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughTreat non-Basic-Latin Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant IME as Input Method
participant App as AppDelegate
participant Layout as KeyboardLayout
participant System
User->>System: press Cmd+P key
System->>IME: generate event.charactersIgnoringModifiers (maybe non‑Latin)
System->>App: deliver NSEvent
App->>App: check charactersIgnoringModifiers
alt charactersIgnoringModifiers is non-empty Basic Latin
App->>App: use event characters to match shortcut
else non-Basic-Latin or empty
App->>Layout: request character(forKeyCode, modifierFlags)
Layout->>Layout: TISCopyCurrentKeyboardLayoutInputSource()
Layout->>App: return translated character
App->>App: use layout/keyCode result to match shortcut
end
App->>System: post commandPaletteSwitcherRequested (if matched)
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 unit tests (beta)
📝 Coding Plan
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.
No issues found across 3 files
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Add one-off context when rerunning by tagging
@cubic-dev-aiwith guidance or docs links (includingllms.txt) - Ask questions if you need clarification on any suggestion
When a non-Latin IME (Korean, Japanese, Chinese, etc.) is active, Cmd+letter shortcuts handled through the custom matchShortcut() path fail because charactersIgnoringModifiers returns non-Latin characters (e.g. Korean jamo) and KeyboardLayout.character() queries the wrong TIS input source. - KeyboardLayout.swift: Use TISCopyCurrentKeyboardLayoutInputSource() to resolve the underlying ASCII-capable layout through the IME - AppDelegate.swift: Treat non-Basic-Latin charactersIgnoringModifiers as absent so the layout translation and keyCode fallback paths are reached - Add 3 tests for IME shortcut routing (layout fallback, layout respected over keyCode, Latin characters still trusted) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@cmuxTests/AppDelegateShortcutRoutingTests.swift`:
- Around line 3260-3261: The test currently calls
appDelegate.handleBrowserSurfaceKeyEquivalent(event) and ignores its Bool return
value, which can hide unexpected consumption; capture the returned Bool from
handleBrowserSurfaceKeyEquivalent(event) and add an explicit XCTAssertFalse on
that result to ensure the event was not consumed while still waiting for
switcherExpectation to validate that .commandPaletteSwitcherRequested was not
posted (reference appDelegate.handleBrowserSurfaceKeyEquivalent and
switcherExpectation).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 3838a37a-1e5b-4486-abe4-21c5f339b2bb
📒 Files selected for processing (3)
Sources/AppDelegate.swiftSources/KeyboardLayout.swiftcmuxTests/AppDelegateShortcutRoutingTests.swift
Address CodeRabbit review: explicitly assert that handleBrowserSurfaceKeyEquivalent returns false when the underlying layout maps to a different letter, instead of discarding the return value. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
firing when a non-Latin IME (Korean, Japanese, Chinese) is active
TISCopyCurrentKeyboardLayoutInputSource()to resolve theunderlying keyboard layout through the IME
charactersIgnoringModifiersas absent to allowlayout translation fallback
Closes #1790
Test plan
Summary by cubic
Fixes Cmd+letter shortcuts not firing with non‑Latin IMEs by resolving the ASCII‑capable layout and ignoring non‑Latin event characters. Shortcuts like Cmd+P, Cmd+T, and Cmd+Shift+L/M now work without regressing English/Dvorak.
TISCopyCurrentKeyboardLayoutInputSource()to resolve the ASCII‑capable layout through IMEs.charactersIgnoringModifierswhen all chars are Basic Latin (U+0020–U+007E); add a helper to enforce this so CJK/jamo are treated as absent for Command shortcuts.Written for commit 40f9280. Summary will update on new commits.
Summary by CodeRabbit
Bug Fixes
Tests