Repository navigation
Fix terminal Cmd+V clipboard payload handling - #1305
Conversation
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAdded two new functions to handle Command-key editing actions (cut/copy/paste/selectAll/undo/redo) through the responder chain, with mainMenu fallback. Modified the key equivalent routing to attempt these actions before delegating to the main menu. Added comprehensive tests for paste scenarios. Changes
Sequence DiagramsequenceDiagram
participant Event as NSEvent (Cmd+V)
participant AppDelegate
participant SCE as standardCommandEditingAction
participant PCA as performCommandEditingAction
participant Responder as Responder Chain
participant MainMenu as NSApp.mainMenu
Event->>AppDelegate: shouldRouteCommandEquivalentDirectlyToMainMenu
AppDelegate->>SCE: Detect editing action from key combo
SCE-->>AppDelegate: Return Selector (paste:)
alt Action detected
AppDelegate->>PCA: Perform action on first responder
PCA->>Responder: Attempt on responder chain
alt Responder handles it
Responder-->>PCA: Success
PCA-->>AppDelegate: Return true
else Responder fails
PCA->>Responder: Attempt on fallback responder
alt Fallback handles it
Responder-->>PCA: Success
PCA-->>AppDelegate: Return true
else All responders fail
PCA-->>AppDelegate: Return false
end
end
else No action
AppDelegate->>MainMenu: performKeyEquivalent
MainMenu-->>AppDelegate: Result
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 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 |
Greptile SummaryThis PR fixes a regression where Key changes:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User as User (Cmd+V)
participant Window as NSWindow<br/>performKeyEquivalent (swizzled)
participant Menu as NSApp.mainMenu<br/>performKeyEquivalent
participant SCA as standardCommandEditingAction()
participant PCA as performCommandEditingAction()
participant FR as self.firstResponder<br/>(responder chain)
participant GV as firstResponderGhosttyView<br/>(GhosttyNSView)
participant Orig as cmux_performKeyEquivalent<br/>(original NSWindow path)
User->>Window: keyDown Cmd+V
Window->>Window: cmuxOwningGhosttyView(firstResponder)?
Note over Window: firstResponderGhosttyView != nil → bypass SwiftUI path
Window->>Window: shouldRouteCommandEquivalentDirectlyToMainMenu? → true
Window->>Menu: performKeyEquivalent(Cmd+V)
Menu-->>Window: false (no paste item in menu)
Window->>SCA: standardCommandEditingAction(event)
SCA-->>Window: #selector(NSText.paste(_:))
Window->>PCA: performCommandEditingAction(paste:, startingAt: FR, fallbackResponder: GV)
PCA->>FR: tryToPerform(paste:, with: nil)
Note over FR: walks responder chain
FR->>GV: paste(nil)
GV-->>PCA: true
PCA-->>Window: true
Window-->>User: return true (event consumed)
Note over Window,Orig: If no editing action matched OR tryToPerform returned false:<br/>fall through to cmux_performKeyEquivalent (original dispatch)
Last reviewed commit: 6bb936d |
6bb936d to
4d4f5d3
Compare
* Add clipboard payload regression tests * Fix terminal clipboard payload handling
Summary
public.pngclipboard bytes directly so browser image pastes avoid the extra image re-encode on the paste pathTesting
xcodebuild -project GhosttyTabs.xcodeproj -scheme cmux-unit -destination 'platform=macOS' -derivedDataPath /tmp/cmux-task-cmd-v-paste-shortcut-unit -only-testing:cmuxTests/GhosttyPasteboardHelperTests testTask