Skip to content

Commit 046554b

Browse files
author
Bassam Data
committed
fix(selecta): fix smooth scrolling not leave empty space
1 parent 5ba9c91 commit 046554b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/namu/selecta/selecta.lua

+7
Original file line numberDiff line numberDiff line change
@@ -769,6 +769,13 @@ local function resize_window(state, opts)
769769
if state.prompt_win and vim.api.nvim_win_is_valid(state.prompt_win) then
770770
vim.api.nvim_win_set_config(state.prompt_win, prompt_config)
771771
end
772+
773+
-- Simple fix: if filtered items are less than window height,
774+
-- ensure we're viewing from the top
775+
if #state.filtered_items <= new_height then
776+
vim.api.nvim_win_set_cursor(state.win, { 1, 0 })
777+
vim.cmd("normal! zt")
778+
end
772779
end
773780

774781
-- Update the footer whenever filtered items change

0 commit comments

Comments
 (0)