Skip to content

Commit efde0c2

Browse files
committed
fix: inconsistent menu cycling behavior
Closes #1637
1 parent e16586c commit efde0c2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lua/blink/cmp/completion/list.lua

+4-2
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ function list.select_next(opts)
183183
-- end of the list
184184
if list.selected_item_idx == #list.items then
185185
-- preselect is not enabled, we go back to no selection
186-
if not list.get_selection_mode(list.context).preselect then return list.select(nil, opts) end
186+
local select_mode = list.get_selection_mode(list.context)
187+
if not select_mode.preselect or select_mode.auto_insert then return list.select(nil, opts) end
187188

188189
-- cycling around has been disabled, ignore
189190
if not list.config.cycle.from_bottom then return end
@@ -209,7 +210,8 @@ function list.select_prev(opts)
209210
-- start of the list
210211
if list.selected_item_idx == 1 then
211212
-- auto_insert is enabled, we go back to no selection
212-
if list.get_selection_mode(list.context).auto_insert then return list.select(nil, opts) end
213+
local select_mode = list.get_selection_mode(list.context)
214+
if not select_mode.preselect or select_mode.auto_insert then return list.select(nil, opts) end
213215

214216
-- cycling around has been disabled, ignore
215217
if not list.config.cycle.from_top then return end

0 commit comments

Comments
 (0)