Repository navigation
Fix close-tab shortcut remapping - #2512
austinywang wants to merge 4 commits into
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 (2)
✅ Files skipped from review due to trivial changes (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe pull request updates shortcut handling across two files. AppDelegate's close-tab comment is reflowed, and ContentView refactors command palette shortcut mapping to resolve dynamic shortcuts from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 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 makes the close-tab shortcut (Cmd+W) user-remappable end-to-end by adding Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant AppDelegate
participant KSS as KeyboardShortcutSettings
participant Menu as File Menu
participant Palette as Command Palette
Note over User,Palette: Before remap (default Cmd+W)
User->>AppDelegate: key event
AppDelegate->>KSS: shortcut(for: .closeTab)
KSS-->>AppDelegate: StoredShortcut(w, ⌘)
AppDelegate->>AppDelegate: matchShortcut → closePanelOrWindow()
Note over User,Palette: After user remaps to Cmd+Q
User->>KSS: setShortcut(.closeTab, Cmd+Q)
KSS->>KSS: UserDefaults.set("shortcut.closeTab")
KSS-->>Menu: @AppStorage triggers closeTabMenuShortcut update
Menu-->>Menu: splitCommandButton rebinds to Cmd+Q
KSS-->>Palette: dynamic lookup via commandPaletteShortcutAction
Palette-->>Palette: hint shows "⌘Q"
User->>AppDelegate: Cmd+Q key event
AppDelegate->>KSS: shortcut(for: .closeTab)
KSS-->>AppDelegate: StoredShortcut(q, ⌘)
AppDelegate->>AppDelegate: matchShortcut → closePanelOrWindow()
|
| case .toggleSidebar: return String(localized: "shortcut.toggleSidebar.label", defaultValue: "Toggle Sidebar") | ||
| case .newTab: return String(localized: "shortcut.newWorkspace.label", defaultValue: "New Workspace") | ||
| case .newWindow: return String(localized: "shortcut.newWindow.label", defaultValue: "New Window") | ||
| case .closeTab: return String(localized: "menu.file.closeTab", defaultValue: "Close Tab") |
There was a problem hiding this comment.
Inconsistent localization key prefix for
closeTab label
Every other Action.label in this switch uses a shortcut.* prefixed key (e.g. shortcut.closeWindow.label, shortcut.newWindow.label), but closeTab reuses the menu-scoped key menu.file.closeTab. The string renders correctly ("Close Tab") since the key already exists, but it creates a naming inconsistency in the settings UI — the translator context for a menu item differs from that for a shortcut settings row.
Consider introducing a dedicated key to stay consistent with the rest of the labels:
| case .closeTab: return String(localized: "menu.file.closeTab", defaultValue: "Close Tab") | |
| case .closeTab: return String(localized: "shortcut.closeTab.label", defaultValue: "Close Tab") |
(Then add "shortcut.closeTab.label" to Resources/Localizable.xcstrings with the same translations as menu.file.closeTab.)
…-1710-cmdw-remap-intercepted # Conflicts: # Sources/AppDelegate.swift # Sources/KeyboardShortcutSettings.swift # Sources/cmuxApp.swift
…-1710-cmdw-remap-intercepted
Summary
closeTabas a remappable action inKeyboardShortcutSettingsso Cmd+W respects user-configured shortcutsAppDelegateinterceptor to use the remapped shortcut instead of a hardcoded Cmd+W checkcloseTabMenuShortcutin the File menu viasplitCommandButtonso the menu item reflects the remapFixes #1710
Test plan
🤖 Generated with Claude Code
Summary by cubic
Make Close Tab respect user-remapped shortcuts across the app. Updates the interceptor, File menu, and command palette to use the dynamic shortcut. Fixes #1710.
KeyboardShortcutSettings.splitCommandButtonwith the decoded shortcut (no hardcoded ⌘W).palette.closeTabandpalette.closeWorkspaceto actions and removes hardcoded hints, so execution and hints use dynamic lookup.Written for commit 27be97e. Summary will update on new commits.
Summary by CodeRabbit