authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-09 13:39:13-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-11 09:00:18-08:00
logc5cbe159935680f201e90eee73619d79b7eb0ad1
tree522e8f0a1b5010df888b76b6dd45142038c4e317
parent2a610f92b9c6254119d13bbc83b50c9ca7d288b4

Fix "Open in editor" to respect worktree path

Both openInEditor and the Cmd+O shortcut now use the thread's worktreePath when available instead of always using activeProject.cwd. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

1 files changed, 5 insertions(+), 3 deletions(-)

apps/web/src/components/ChatView.tsx+5-3
...@@ -368,17 +368,19 @@ export default function ChatView() {...@@ -368,17 +368,19 @@ export default function ChatView() {
368 if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {368 if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
369 if (api && activeProject) {369 if (api && activeProject) {
370 e.preventDefault();370 e.preventDefault();
371 void api.shell.openInEditor(activeProject.cwd, lastEditor);371 const cwd = activeThread?.worktreePath ?? activeProject.cwd;
372 void api.shell.openInEditor(cwd, lastEditor);
372 }373 }
373 }374 }
374 };375 };
375 window.addEventListener("keydown", handler);376 window.addEventListener("keydown", handler);
376 return () => window.removeEventListener("keydown", handler);377 return () => window.removeEventListener("keydown", handler);
377 }, [api, activeProject, lastEditor]);378 }, [api, activeProject, activeThread, lastEditor]);
378379
379 const openInEditor = (editorId: EditorId) => {380 const openInEditor = (editorId: EditorId) => {
380 if (!api || !activeProject) return;381 if (!api || !activeProject) return;
381 void api.shell.openInEditor(activeProject.cwd, editorId);382 const cwd = activeThread?.worktreePath ?? activeProject.cwd;
383 void api.shell.openInEditor(cwd, editorId);
382 setLastEditor(editorId);384 setLastEditor(editorId);
383 localStorage.setItem(LAST_EDITOR_KEY, editorId);385 localStorage.setItem(LAST_EDITOR_KEY, editorId);
384 setIsEditorMenuOpen(false);386 setIsEditorMenuOpen(false);