Fix for cmdheight=0

Fixes #1196
Fixes hrsh7th/cmp-cmdline#64
This commit is contained in:
hrsh7th
2022-10-02 20:22:13 +09:00
parent beb1d14c5e
commit 203aa26fc2

View File

@@ -47,7 +47,8 @@ end
---@return { [1]: integer, [2]: integer }
api.get_cursor = function()
if api.is_cmdline_mode() then
return { vim.o.lines - (vim.api.nvim_get_option('cmdheight') or 1) + 1, vim.fn.getcmdpos() - 1 }
return { math.min(vim.o.lines, vim.o.lines - (vim.api.nvim_get_option('cmdheight') - 1)), vim.fn.getcmdpos() - 1 }
end
return vim.api.nvim_win_get_cursor(0)
end