File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 27
27
--- @field accept fun ( opts ?: blink.cmp.CompletionListAcceptOpts ): boolean Applies the currently selected item , returning true if it succeeded
28
28
29
29
--- @class blink.cmp.CompletionListSelectOpts
30
+ --- @field count ? number The number of items to jump by , defaults to 1
30
31
--- @field auto_insert ? boolean Insert the completion item automatically when selecting it
31
32
--- @field on_ghost_text ? boolean Run when ghost text is visible , instead of only when the menu is visible
32
33
@@ -198,7 +199,8 @@ function list.select_next(opts)
198
199
end
199
200
200
201
-- typical case, select the next item
201
- list .select (list .selected_item_idx + 1 , opts )
202
+ local count = opts and opts .count or 1
203
+ list .select (math.min (list .selected_item_idx + count , # list .items ), opts )
202
204
end
203
205
204
206
function list .select_prev (opts )
@@ -225,7 +227,8 @@ function list.select_prev(opts)
225
227
end
226
228
227
229
-- typical case, select the previous item
228
- list .select (list .selected_item_idx - 1 , opts )
230
+ local count = opts and opts .count or 1
231
+ list .select (math.max (list .selected_item_idx - count , 1 ), opts )
229
232
end
230
233
231
234
---- ------ Preview ----------
You can’t perform that action at this time.
0 commit comments