@@ -42,12 +42,12 @@ import {
42
42
setDialogMessage ,
43
43
setShowDialog ,
44
44
} from "../../redux/slices/uiSlice" ;
45
- import { cancelStream } from "../../redux/thunks/cancelStream" ;
46
45
import { streamEditThunk } from "../../redux/thunks/edit" ;
47
46
import { loadLastSession } from "../../redux/thunks/session" ;
48
47
import { streamResponseThunk } from "../../redux/thunks/streamResponse" ;
49
48
import { isJetBrains , isMetaEquivalentKeyPressed } from "../../util" ;
50
49
50
+ import { cancelStream } from "../../redux/thunks/cancelStream" ;
51
51
import { getLocalStorage , setLocalStorage } from "../../util/localStorage" ;
52
52
import { EmptyChatBody } from "./EmptyChatBody" ;
53
53
import { ExploreDialogWatcher } from "./ExploreDialogWatcher" ;
@@ -125,22 +125,22 @@ export function Chat() {
125
125
126
126
useEffect ( ( ) => {
127
127
// Cmd + Backspace to delete current step
128
- const listener = ( e : any ) => {
128
+ const listener = ( e : KeyboardEvent ) => {
129
129
if (
130
130
e . key === "Backspace" &&
131
131
( jetbrains ? e . altKey : isMetaEquivalentKeyPressed ( e ) ) &&
132
132
! e . shiftKey
133
133
) {
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" , { } ) ;
136
136
}
137
137
} ;
138
138
window . addEventListener ( "keydown" , listener ) ;
139
139
140
140
return ( ) => {
141
141
window . removeEventListener ( "keydown" , listener ) ;
142
142
} ;
143
- } , [ isStreaming , jetbrains ] ) ;
143
+ } , [ isStreaming , jetbrains , isInEdit ] ) ;
144
144
145
145
const { widget, highlights } = useFindWidget (
146
146
stepsDivRef ,
0 commit comments