Skip to content

Commit

Permalink
fix(cmdline): make sure cursor is always visible
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed Mar 12, 2023
1 parent c226516 commit 2f0a427
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lua/noice/ui/cmdline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,14 @@ function M.on_render(_, buf, line, byte)

local cursor = byte - M.last():length() + M.last().state.pos
vim.api.nvim_win_set_cursor(win, { 1, cursor })
vim.api.nvim_win_call(win, function()
vim.cmd([[noautocmd silent! normal! ze]])

vim.schedule(function()
if vim.api.nvim_win_is_valid(win) then
vim.api.nvim_win_set_cursor(win, { 1, cursor })
vim.api.nvim_win_call(win, function()
vim.cmd([[noautocmd silent! normal! ze]])
end)
end
end)

local pos = vim.fn.screenpos(win, line, cmdline_start)
Expand Down

0 comments on commit 2f0a427

Please sign in to comment.