@@ -29,6 +29,7 @@ import { SubmenuContextProvidersContext } from "../../App";
29
29
import useHistory from "../../hooks/useHistory" ;
30
30
import useUpdatingRef from "../../hooks/useUpdatingRef" ;
31
31
import { useWebviewListener } from "../../hooks/useWebviewListener" ;
32
+ import { selectUseActiveFile } from "../../redux/selectors" ;
32
33
import { defaultModelSelector } from "../../redux/selectors/modelSelectors" ;
33
34
import { setEditingContextItemAtIndex } from "../../redux/slices/stateSlice" ;
34
35
import { RootState } from "../../redux/store" ;
@@ -137,6 +138,8 @@ function TipTapEditor(props: TipTapEditorProps) {
137
138
( store : RootState ) => store . state . history . length ,
138
139
) ;
139
140
141
+ const useActiveFile = useSelector ( selectUseActiveFile ) ;
142
+
140
143
const [ inputFocused , setInputFocused ] = useState ( false ) ;
141
144
142
145
const { saveSession } = useHistory ( dispatch ) ;
@@ -250,15 +253,20 @@ function TipTapEditor(props: TipTapEditorProps) {
250
253
return false ;
251
254
}
252
255
253
- onEnterRef . current ( { useCodebase : false } ) ;
256
+ onEnterRef . current ( {
257
+ useCodebase : false ,
258
+ noContext : ! useActiveFile ,
259
+ } ) ;
254
260
return true ;
255
261
} ,
256
262
257
263
"Cmd-Enter" : ( ) => {
258
- onEnterRef . current ( { useCodebase : true } ) ;
264
+ onEnterRef . current ( {
265
+ useCodebase : true ,
266
+ noContext : ! useActiveFile ,
267
+ } ) ;
259
268
return true ;
260
269
} ,
261
-
262
270
"Shift-Enter" : ( ) =>
263
271
this . editor . commands . first ( ( { commands } ) => [
264
272
( ) => commands . newlineInCode ( ) ,
@@ -409,7 +417,7 @@ function TipTapEditor(props: TipTapEditorProps) {
409
417
return ;
410
418
}
411
419
editor ?. commands . insertContent ( data . input ) ;
412
- onEnterRef . current ( { useCodebase : false } ) ;
420
+ onEnterRef . current ( { useCodebase : false , noContext : true } ) ;
413
421
} ,
414
422
[ editor , onEnterRef . current , props . isMainInput ] ,
415
423
) ;
0 commit comments