File tree Expand file tree Collapse file tree 3 files changed +6
-4
lines changed
Expand file tree Collapse file tree 3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -156,7 +156,8 @@ const AIChatInputBar = memo(function AIChatInputBar({
156156 if ( mentionState . active ) {
157157 if ( e . key === "ArrowDown" ) {
158158 e . preventDefault ( ) ;
159- selectNext ( ) ;
159+ const filteredFiles = getFilteredFiles ( allProjectFiles ) ;
160+ selectNext ( filteredFiles . length ) ;
160161 } else if ( e . key === "ArrowUp" ) {
161162 e . preventDefault ( ) ;
162163 selectPrevious ( ) ;
Original file line number Diff line number Diff line change @@ -412,9 +412,10 @@ export const useAIChatStore = create<AIChatState & AIChatActions>()(
412412 state . mentionState . position = position ;
413413 } ) ,
414414
415- selectNext : ( ) =>
415+ selectNext : ( totalItems : number ) =>
416416 set ( ( state ) => {
417- state . mentionState . selectedIndex = Math . min ( state . mentionState . selectedIndex + 1 , 4 ) ;
417+ const maxIndex = Math . max ( totalItems - 1 , 0 ) ;
418+ state . mentionState . selectedIndex = Math . min ( state . mentionState . selectedIndex + 1 , maxIndex ) ;
418419 } ) ,
419420
420421 selectPrevious : ( ) =>
Original file line number Diff line number Diff line change @@ -74,7 +74,7 @@ export interface AIChatActions {
7474 hideMention : ( ) => void ;
7575 updateSearch : ( search : string ) => void ;
7676 updatePosition : ( position : { top : number ; left : number } ) => void ;
77- selectNext : ( ) => void ;
77+ selectNext : ( totalItems : number ) => void ;
7878 selectPrevious : ( ) => void ;
7979 setSelectedIndex : ( index : number ) => void ;
8080 getFilteredFiles : ( allFiles : FileEntry [ ] ) => FileEntry [ ] ;
You can’t perform that action at this time.
0 commit comments