Elffuss BraidHub

kikocis/continue public

Merge pull request #6310 from uinstinct/fix-backspace-focus

fix: prevent focus out on mod backspace in chat area
Changesetabb85586e0956b9115db6eb5eb5270352e067b1945c666dea84c8ddb762408f0
AuthorNate Sesti <33237525+sestinj@users.noreply.github.com> · 2025-06-26 21:03 -07:00
CommitterGitHub <noreply@github.com> · 2025-06-26 21:03 -07:00
Parents6ae8fdd230bd, c286b0a1acf2

Browse the files at this changeset

2 files changed

modified gui/src/pages/gui/Chat.tsx +5 −5
@@ -42,12 +42,12 @@
4242 setDialogMessage,
4343 setShowDialog,
4444 } from "../../redux/slices/uiSlice";
45-import { cancelStream } from "../../redux/thunks/cancelStream";
4645 import { streamEditThunk } from "../../redux/thunks/edit";
4746 import { loadLastSession } from "../../redux/thunks/session";
4847 import { streamResponseThunk } from "../../redux/thunks/streamResponse";
4948 import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util";
5049
50+import { cancelStream } from "../../redux/thunks/cancelStream";
5151 import { getLocalStorage, setLocalStorage } from "../../util/localStorage";
5252 import { EmptyChatBody } from "./EmptyChatBody";
5353 import { ExploreDialogWatcher } from "./ExploreDialogWatcher";
@@ -125,14 +125,14 @@
125125
126126 useEffect(() => {
127127 // Cmd + Backspace to delete current step
128- const listener = (e: any) => {
128+ const listener = (e: KeyboardEvent) => {
129129 if (
130130 e.key === "Backspace" &&
131131 (jetbrains ? e.altKey : isMetaEquivalentKeyPressed(e)) &&
132132 !e.shiftKey
133133 ) {
134- dispatch(cancelStream());
135- ideMessenger.post("rejectDiff", {}); // just always cancel, if not in applying won't matter
134+ void dispatch(cancelStream());
135+ if (isInEdit) ideMessenger.post("rejectDiff", {});
136136 }
137137 };
138138 window.addEventListener("keydown", listener);
@@ -140,7 +140,7 @@
140140 return () => {
141141 window.removeEventListener("keydown", listener);
142142 };
143- }, [isStreaming, jetbrains]);
143+ }, [isStreaming, jetbrains, isInEdit]);
144144
145145 const { widget, highlights } = useFindWidget(
146146 stepsDivRef,
modified gui/src/util/index.ts +5 −5
@@ -1,12 +1,12 @@
11 import { MessageModes, ModelDescription } from "core";
22 import { ProfileDescription } from "core/config/ProfileLifecycleManager";
3-import _ from "lodash";
4-import { KeyboardEvent } from "react";
5-import { getLocalStorage } from "./localStorage";
63 import {
7- DEFAULT_CHAT_SYSTEM_MESSAGE,
84 DEFAULT_AGENT_SYSTEM_MESSAGE,
5+ DEFAULT_CHAT_SYSTEM_MESSAGE,
96 } from "core/llm/constructMessages";
7+import _ from "lodash";
8+import { KeyboardEvent as ReactKeyboardEvent } from "react";
9+import { getLocalStorage } from "./localStorage";
1010
1111 export type Platform = "mac" | "linux" | "windows" | "unknown";
1212
@@ -26,7 +26,7 @@
2626 export function isMetaEquivalentKeyPressed({
2727 metaKey,
2828 ctrlKey,
29-}: KeyboardEvent): boolean {
29+}: KeyboardEvent | ReactKeyboardEvent): boolean {
3030 const platform = getPlatform();
3131 switch (platform) {
3232 case "mac":