Skip to content

Commit 9266405

Browse files
committed
use alt instead of cmd+backspace in jetbrains
1 parent 529ea27 commit 9266405

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

gui/src/components/mainInput/Lump/LumpToolbar.tsx

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,12 @@ import { selectCurrentToolCall } from "../../../redux/selectors/selectCurrentToo
88
import { callCurrentTool } from "../../../redux/thunks/callCurrentTool";
99
import { cancelCurrentToolCall } from "../../../redux/thunks/cancelCurrentToolCall";
1010
import { cancelStream } from "../../../redux/thunks/cancelStream";
11-
import { getFontSize, getMetaKeyLabel } from "../../../util";
11+
import {
12+
getAltKeyLabel,
13+
getFontSize,
14+
getMetaKeyLabel,
15+
isJetBrains,
16+
} from "../../../util";
1217
import { EnterButton } from "../InputToolbar/EnterButton";
1318
import { BlockSettingsTopToolbar } from "./BlockSettingsTopToolbar";
1419

@@ -40,18 +45,20 @@ export function LumpToolbar() {
4045
const ideMessenger = useContext(IdeMessengerContext);
4146
const ttsActive = useAppSelector((state) => state.ui.ttsActive);
4247
const isStreaming = useAppSelector((state) => state.session.isStreaming);
48+
const jetbrains = isJetBrains();
4349

4450
const toolCallState = useSelector(selectCurrentToolCall);
4551

4652
const handleKeyDown = (event: KeyboardEvent) => {
4753
if (toolCallState?.status === "generated") {
4854
const metaKey = event.metaKey || event.ctrlKey;
55+
const altKey = event.altKey;
4956

5057
if (metaKey && event.key === "Enter") {
5158
event.preventDefault();
5259
event.stopPropagation();
5360
dispatch(callCurrentTool());
54-
} else if (metaKey && event.key === "Backspace") {
61+
} else if ((jetbrains ? altKey : metaKey) && event.key === "Backspace") {
5562
event.preventDefault();
5663
event.stopPropagation();
5764
dispatch(cancelCurrentToolCall());
@@ -92,7 +99,8 @@ export function LumpToolbar() {
9299
dispatch(cancelStream());
93100
}}
94101
>
95-
{getMetaKeyLabel()} ⌫ Cancel
102+
{/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
103+
{jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
96104
</StopButton>
97105
</Container>
98106
);
@@ -109,7 +117,8 @@ export function LumpToolbar() {
109117
onClick={() => dispatch(cancelCurrentToolCall())}
110118
data-testid="reject-tool-call-button"
111119
>
112-
{getMetaKeyLabel()} ⌫ Cancel
120+
{/* JetBrains overrides cmd+backspace, so we have to use another shortcut */}
121+
{jetbrains ? getAltKeyLabel() : getMetaKeyLabel()} ⌫ Cancel
113122
</StopButton>
114123
<EnterButton
115124
isPrimary={true}

gui/src/pages/gui/Chat.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ import { cancelStream } from "../../redux/thunks/cancelStream";
4848
import { exitEditMode } from "../../redux/thunks/exitEditMode";
4949
import { loadLastSession } from "../../redux/thunks/session";
5050
import { streamResponseThunk } from "../../redux/thunks/streamResponse";
51-
import { isMetaEquivalentKeyPressed } from "../../util";
51+
import { isJetBrains, isMetaEquivalentKeyPressed } from "../../util";
5252
import {
5353
FREE_TRIAL_LIMIT_REQUESTS,
5454
incrementFreeTrialCount,
@@ -130,14 +130,15 @@ export function Chat() {
130130
const hasDismissedExploreDialog = useAppSelector(
131131
(state) => state.ui.hasDismissedExploreDialog,
132132
);
133+
const jetbrains = isJetBrains();
133134

134135
useEffect(() => {
135136
// Cmd + Backspace to delete current step
136137
const listener = (e: any) => {
137138
if (
138-
e.key === "Backspace" &&
139-
isMetaEquivalentKeyPressed(e) &&
140-
!e.shiftKey
139+
e.key === "Backspace" && jetbrains
140+
? e.altKey
141+
: isMetaEquivalentKeyPressed(e) && !e.shiftKey
141142
) {
142143
dispatch(cancelStream());
143144
}
@@ -339,8 +340,8 @@ export function Chat() {
339340
inputId={item.message.id}
340341
/>
341342
</>
342-
) : item.message.role === "tool" ? null : // /> // toolCallId={item.message.toolCallId} // contextItems={item.contextItems} // <ToolOutput
343-
item.message.role === "assistant" &&
343+
) : item.message.role === "tool" ? null : item.message.role === // /> // toolCallId={item.message.toolCallId} // contextItems={item.contextItems} // <ToolOutput
344+
"assistant" &&
344345
item.message.toolCalls &&
345346
item.toolCallState ? (
346347
<div>

0 commit comments

Comments
 (0)