Fix text insertion on Dvorak-QWERTY hybrid keyboard layout#163
Fix text insertion on Dvorak-QWERTY hybrid keyboard layout#163darknoon wants to merge 1 commit intokitlangton:mainfrom
Conversation
📝 WalkthroughWalkthroughAdds layout-aware Cmd+V handling to ensure the correct V key code is used on hybrid keyboard layouts (e.g., Dvorak — QWERTY ⌘) so paste-based text insertion works across different input configurations. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 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
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@Hex/Clients/PasteboardClient.swift`:
- Around line 333-345: Update the comment above the usesQWERTYShortcuts() method
to append the GitHub issue reference in the mandated format; modify the
hybrid-layout comment that currently reads "Hybrid layouts that switch to QWERTY
when Command is held" by adding the issue number in parentheses (e.g. (`#123`)) so
the comment references the filed issue per guidelines.
🧹 Nitpick comments (1)
Hex/Clients/PasteboardClient.swift (1)
322-331: Prefer the named constant for V’s key code (avoid magic number).
UsekVK_ANSI_Vfor clarity and to leverage the Carbon import.♻️ Suggested change
- if usesQWERTYShortcuts() { - return 9 // kVK_ANSI_V (QWERTY V position) - } + if usesQWERTYShortcuts() { + return CGKeyCode(kVK_ANSI_V) + } return Sauce.shared.keyCode(for: .v)
The Cmd+V paste operation was using Sauce.shared.keyCode(for: .v) which returns the layout's V key position. On "Dvorak — QWERTY ⌘" layout, this returned the Dvorak V position, but when Command is held, this hybrid layout switches to QWERTY positions—causing a mismatch and error beep. Added detection for hybrid layouts (currently "Dvorak — QWERTY ⌘") that use QWERTY positions for Command shortcuts. For these layouts, we use the hardcoded QWERTY V key code (9). All other layouts continue using Sauce's layout-aware key code. Fixes kitlangton#162 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
a584fc9 to
170fb2c
Compare
Summary
Fixes #162 - Text insertion was broken on the "Dvorak — QWERTY ⌘" keyboard layout.
The
Cmd+Vpaste operation was usingSauce.shared.keyCode(for: .v)which returns the layout's V key position. On hybrid layouts like "Dvorak — QWERTY ⌘", this returned the Dvorak V position, but when Command is held, the layout switches to QWERTY positions—causing a mismatch and error beep.Fix: Added detection for hybrid layouts that use QWERTY positions for Command shortcuts. For these layouts, we use the hardcoded QWERTY V key code (9). All other layouts continue using Sauce's layout-aware key code.
Test plan
🤖 Generated with Claude Code
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.