Skip to content

Commit bb5407d

Browse files
committed
fix: ensure menu selection index is within bounds
Closes #416
1 parent 4559ec5 commit bb5407d

File tree

1 file changed

+1
-0
lines changed
  • lua/blink/cmp/completion/windows

1 file changed

+1
-0
lines changed

lua/blink/cmp/completion/windows/menu.lua

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ vim.api.nvim_create_autocmd({ 'CursorMovedI', 'WinScrolled', 'WinResized' }, {
4848
function menu.open_with_items(context, items)
4949
menu.context = context
5050
menu.items = items
51+
menu.selected_item_idx = menu.selected_item_idx ~= nil and math.min(menu.selected_item_idx, #items) or nil
5152

5253
if not menu.renderer then menu.renderer = require('blink.cmp.completion.windows.render').new(config.draw) end
5354
menu.renderer:draw(menu.win:get_buf(), items)

0 commit comments

Comments
 (0)