From fc3f7ac54ef7e3ea1c85582caee6c330170e0148 Mon Sep 17 00:00:00 2001 From: Dallin Romney Date: Wed, 30 Apr 2025 19:33:38 -0700 Subject: [PATCH] fix toggling focus and history -> edit mode --- extensions/vscode/src/commands.ts | 3 --- gui/src/components/History/HistoryTableRow.tsx | 2 ++ gui/src/components/Layout.tsx | 4 ++-- gui/src/components/modelSelection/ModeSelect.tsx | 2 +- gui/src/redux/thunks/editMode.ts | 4 ++-- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/extensions/vscode/src/commands.ts b/extensions/vscode/src/commands.ts index c62a340b4..c651f1eb2 100644 --- a/extensions/vscode/src/commands.ts +++ b/extensions/vscode/src/commands.ts @@ -117,10 +117,7 @@ async function processDiff( return; } - // if (!currentFile || newOrCurrentUri !== currentFile.path) { await ide.openFile(newOrCurrentUri); - // focusGUI(); - // } // Clear vertical diffs depending on action verticalDiffManager.clearForfileUri(newOrCurrentUri, action === "accept"); diff --git a/gui/src/components/History/HistoryTableRow.tsx b/gui/src/components/History/HistoryTableRow.tsx index 8b7f3ba38..91854a274 100644 --- a/gui/src/components/History/HistoryTableRow.tsx +++ b/gui/src/components/History/HistoryTableRow.tsx @@ -6,6 +6,7 @@ import { useNavigate } from "react-router-dom"; import { Input } from ".."; import { IdeMessengerContext } from "../../context/IdeMessenger"; import { useAppDispatch, useAppSelector } from "../../redux/hooks"; +import { exitEditMode } from "../../redux/thunks/editMode"; import { deleteSession, getSession, @@ -68,6 +69,7 @@ export function HistoryTableRow({ data-testid={`history-row-${index}`} className="hover:bg-vsc-editor-background relative box-border flex cursor-pointer overflow-hidden rounded-lg p-3" onClick={async () => { + await dispatch(exitEditMode({})); if (sessionMetadata.sessionId !== currentSessionId) { await dispatch( loadSession({ diff --git a/gui/src/components/Layout.tsx b/gui/src/components/Layout.tsx index 381904afd..46d681c8d 100644 --- a/gui/src/components/Layout.tsx +++ b/gui/src/components/Layout.tsx @@ -164,7 +164,7 @@ const Layout = () => { }), ); }, - [mode], + [], ); useWebviewListener( @@ -172,7 +172,7 @@ const Layout = () => { async () => { await dispatch(exitEditMode({})); }, - [mode], + [], ); useEffect(() => { diff --git a/gui/src/components/modelSelection/ModeSelect.tsx b/gui/src/components/modelSelection/ModeSelect.tsx index ee6871298..21c0fbf68 100644 --- a/gui/src/components/modelSelection/ModeSelect.tsx +++ b/gui/src/components/modelSelection/ModeSelect.tsx @@ -128,7 +128,7 @@ function ModeSelect() { document.addEventListener("keydown", handleKeyDown); return () => document.removeEventListener("keydown", handleKeyDown); - }, [dispatch, mode, jetbrains]); + }, [cycleMode]); return ( diff --git a/gui/src/redux/thunks/editMode.ts b/gui/src/redux/thunks/editMode.ts index 8323ed7a5..4341b14a4 100644 --- a/gui/src/redux/thunks/editMode.ts +++ b/gui/src/redux/thunks/editMode.ts @@ -72,9 +72,9 @@ export const exitEditMode = createAsyncThunk< return; } - for (const code of codeToEdit) { + if (codeToEdit[0] && state.editModeState.applyState.numDiffs) { extra.ideMessenger.post("rejectDiff", { - filepath: code.filepath, + filepath: codeToEdit[0].filepath, }); }