refactor(completion): clean up popup scroll API

This commit is contained in:
2026-04-17 00:14:55 +02:00
parent 47f36adc21
commit f4d3a35171
2 changed files with 10 additions and 16 deletions
+5 -5
View File
@@ -174,20 +174,20 @@ function M.setup()
end, { expr = true, replace_keycodes = true })
end
scroll_map("<C-d>", function()
popup:scroll_half(vim.keycode("<C-e>"))
popup:scroll("down", Popup.HALF_PAGE)
end)
scroll_map("<C-u>", function()
popup:scroll_half(vim.keycode("<C-y>"))
popup:scroll("up", Popup.HALF_PAGE)
end)
scroll_map("<C-j>", function()
popup:scroll_line(vim.keycode("<C-e>"))
popup:scroll("down", 1)
end)
scroll_map("<C-k>", function()
popup:scroll_line(vim.keycode("<C-y>"))
popup:scroll("up", 1)
end)
vim.keymap.set("i", "<CR>", function()
if vim.fn.pumvisible() ~= 0 then
if popup:is_visible() then
return "<C-y>"
end
return "<CR>"