Skip to content

Commit e023c5f

Browse files
committed
fix: scroll cmdline to make sure cursor is always visible. Fixes #196
1 parent 9dc2508 commit e023c5f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lua/noice/ui/cmdline.lua

+7
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ function M.on_render(_, buf, line, byte)
179179
-- FIXME: check with cmp
180180
-- FIXME: state.pos?
181181
local cmdline_start = byte - (M.last():length() - M.last().offset)
182+
183+
local cursor = byte - M.last():length() + M.last().state.pos
184+
vim.api.nvim_win_set_cursor(win, { 1, cursor })
185+
vim.api.nvim_win_call(win, function()
186+
vim.cmd([[silent! normal! ze]])
187+
end)
188+
182189
local pos = vim.fn.screenpos(win, line, cmdline_start)
183190
M.position = {
184191
buf = buf,

0 commit comments

Comments
 (0)