Skip to content

Commit ce0e36d

Browse files
🤖 fix: wire up OPEN_IN_EDITOR keybind handler (#1059)
The `Ctrl+Shift+E` (`Cmd+Shift+E` on Mac) shortcut was defined in `KEYBINDS` and shown in the tooltip, but no keyboard listener was ever registered. Adds the handler to `useAIViewKeybinds` alongside `OPEN_TERMINAL`. _Generated with `mux`_
1 parent 7e7d883 commit ce0e36d

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

bun.lock

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"lockfileVersion": 1,
3+
"configVersion": 0,
34
"workspaces": {
45
"": {
56
"name": "mux",

src/browser/components/AIView.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import { ProviderOptionsProvider } from "@/browser/contexts/ProviderOptionsConte
3434
import { formatKeybind, KEYBINDS } from "@/browser/utils/ui/keybinds";
3535
import { useAutoScroll } from "@/browser/hooks/useAutoScroll";
3636
import { useOpenTerminal } from "@/browser/hooks/useOpenTerminal";
37+
import { useOpenInEditor } from "@/browser/hooks/useOpenInEditor";
3738
import { readPersistedState, usePersistedState } from "@/browser/hooks/usePersistedState";
3839
import { useThinking } from "@/browser/contexts/ThinkingContext";
3940
import {
@@ -371,6 +372,11 @@ const AIViewInner: React.FC<AIViewProps> = ({
371372
openTerminal(workspaceId, runtimeConfig);
372373
}, [workspaceId, openTerminal, runtimeConfig]);
373374

375+
const openInEditor = useOpenInEditor();
376+
const handleOpenInEditor = useCallback(() => {
377+
void openInEditor(workspaceId, namedWorkspacePath, runtimeConfig);
378+
}, [workspaceId, namedWorkspacePath, openInEditor, runtimeConfig]);
379+
374380
// Auto-scroll when messages or todos update (during streaming)
375381
useEffect(() => {
376382
if (workspaceState && autoScroll) {
@@ -414,6 +420,7 @@ const AIViewInner: React.FC<AIViewProps> = ({
414420
chatInputAPI,
415421
jumpToBottom,
416422
handleOpenTerminal,
423+
handleOpenInEditor,
417424
aggregator,
418425
setEditingMessage,
419426
vimEnabled,

src/browser/hooks/useAIViewKeybinds.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ interface UseAIViewKeybindsParams {
2222
chatInputAPI: React.RefObject<ChatInputAPI | null>;
2323
jumpToBottom: () => void;
2424
handleOpenTerminal: () => void;
25+
handleOpenInEditor: () => void;
2526
aggregator: StreamingMessageAggregator | undefined; // For compaction detection
2627
setEditingMessage: (editing: { id: string; content: string } | undefined) => void;
2728
vimEnabled: boolean; // For vim-aware interrupt keybind
@@ -34,6 +35,7 @@ interface UseAIViewKeybindsParams {
3435
* - Ctrl+Shift+T: Toggle thinking level
3536
* - Ctrl+G: Jump to bottom
3637
* - Ctrl+T: Open terminal
38+
* - Ctrl+Shift+E: Open in editor
3739
* - Ctrl+C (during compaction in vim mode): Cancel compaction, restore command
3840
*
3941
* Note: In vim mode, Ctrl+C always interrupts streams. Use vim yank (y) commands for copying.
@@ -49,6 +51,7 @@ export function useAIViewKeybinds({
4951
chatInputAPI,
5052
jumpToBottom,
5153
handleOpenTerminal,
54+
handleOpenInEditor,
5255
aggregator,
5356
setEditingMessage,
5457
vimEnabled,
@@ -144,6 +147,9 @@ export function useAIViewKeybinds({
144147
} else if (matchesKeybind(e, KEYBINDS.OPEN_TERMINAL)) {
145148
e.preventDefault();
146149
handleOpenTerminal();
150+
} else if (matchesKeybind(e, KEYBINDS.OPEN_IN_EDITOR)) {
151+
e.preventDefault();
152+
handleOpenInEditor();
147153
}
148154
};
149155

@@ -152,6 +158,7 @@ export function useAIViewKeybinds({
152158
}, [
153159
jumpToBottom,
154160
handleOpenTerminal,
161+
handleOpenInEditor,
155162
workspaceId,
156163
canInterrupt,
157164
showRetryBarrier,

0 commit comments

Comments
 (0)