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() {
368368 if (e.key === "o" && (e.metaKey || e.ctrlKey) && !e.shiftKey) {
369369 if (api && activeProject) {
370370 e.preventDefault();
371 void api.shell.openInEditor(activeProject.cwd, lastEditor);
371 const cwd = activeThread?.worktreePath ?? activeProject.cwd;
372 void api.shell.openInEditor(cwd, lastEditor);
372373 }
373374 }
374375 };
375376 window.addEventListener("keydown", handler);
376377 return () => window.removeEventListener("keydown", handler);
377 }, [api, activeProject, lastEditor]);
378 }, [api, activeProject, activeThread, lastEditor]);
378379
379380 const openInEditor = (editorId: EditorId) => {
380381 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);
382384 setLastEditor(editorId);
383385 localStorage.setItem(LAST_EDITOR_KEY, editorId);
384386 setIsEditorMenuOpen(false);