Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR introduces a new terminal command-shortcut routing mechanism that enables Command-key shortcuts to be passed through to the Ghostty terminal view instead of being handled by the app's menu system. A new function Changes
Sequence DiagramsequenceDiagram
participant User
participant NSWindow
participant Router as shouldRouteTerminalCommand<br/>ShortcutToGhostty()
participant GhosttyView as Ghostty Terminal View
participant AppMenu as App Menu System
User->>NSWindow: Press Command+Key
NSWindow->>NSWindow: cmux_performKeyEquivalent
NSWindow->>NSWindow: Check if Ghostty view focused
alt Ghostty view focused
NSWindow->>Router: Evaluate routing decision<br/>(flags, keyCode, selection)
alt Should route to Ghostty
Router-->>NSWindow: Return true
NSWindow->>GhosttyView: keyDown(with:event)
GhosttyView->>User: Handle shortcut in terminal
else Keep in app (Cmd+, or selection)
Router-->>NSWindow: Return false
NSWindow->>AppMenu: Handle via menu system
AppMenu->>User: Execute app-level action
end
else Ghostty not focused
NSWindow->>AppMenu: Handle via menu system
AppMenu->>User: Execute app-level action
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
cmuxTests/CmuxWebViewKeyEquivalentTests.swift (1)
2190-2207: Split the dual-assert test into separate test methods for sharper failures.
testRoutesOtherCommandShortcutsToTerminalcurrently validates two unrelated inputs. Splitting them makes failures more actionable during regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift` around lines 2190 - 2207, Split the dual-assert test testRoutesOtherCommandShortcutsToTerminal into two distinct tests so each assertion fails independently: create one test (e.g., testRouteCommandOptionCToTerminal) that calls shouldRouteTerminalCommandShortcutToGhostty(flags: [.command, .option], chars: "c", keyCode: 8, terminalHasSelection: false) and asserts true, and a second test (e.g., testRouteCommandVToTerminal) that calls shouldRouteTerminalCommandShortcutToGhostty(flags: [.command], chars: "v", keyCode: 9, terminalHasSelection: false) and asserts true; keep the same parameters and expectations, just move each XCTAssertTrue into its own test method to improve test failure granularity.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@cmuxTests/CmuxWebViewKeyEquivalentTests.swift`:
- Around line 2190-2207: Split the dual-assert test
testRoutesOtherCommandShortcutsToTerminal into two distinct tests so each
assertion fails independently: create one test (e.g.,
testRouteCommandOptionCToTerminal) that calls
shouldRouteTerminalCommandShortcutToGhostty(flags: [.command, .option], chars:
"c", keyCode: 8, terminalHasSelection: false) and asserts true, and a second
test (e.g., testRouteCommandVToTerminal) that calls
shouldRouteTerminalCommandShortcutToGhostty(flags: [.command], chars: "v",
keyCode: 9, terminalHasSelection: false) and asserts true; keep the same
parameters and expectations, just move each XCTAssertTrue into its own test
method to improve test failure granularity.
Greptile SummaryThis PR adds support for custom tmux prefixes using Command-based keyboard shortcuts. The implementation introduces a new routing function Key changes:
The implementation follows existing patterns in the codebase (similar to Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Key Event] --> B{Local Event Monitor<br/>`handleCustomShortcut`}
B -->|Cmd+Q, Cmd+N, Cmd+T, Cmd+W<br/>handled| C[Event Consumed]
B -->|Pass through| D{`performKeyEquivalent`}
D --> E{Terminal focused?}
E -->|No| F[Normal event handling]
E -->|Yes| G{Font zoom shortcut?}
G -->|Yes| H[Route to terminal]
G -->|No| I{Browser event?}
I -->|Yes| J[Handle browser event]
I -->|No| K{**NEW: Command shortcut?**<br/>`shouldRouteTerminalCommand...`}
K -->|Cmd+, or<br/>Cmd+C with selection| L{Main menu check}
K -->|Other Cmd shortcuts| M[Route to terminal<br/>for tmux prefix]
L -->|Consumed by menu| C
L -->|Not consumed| F
Last reviewed commit: 253c196 |
Summary by CodeRabbit
New Features
Tests