mirror of
https://github.com/tiyn/nvim-docs-view.git
synced 2025-11-13 13:59:46 +01:00
fix: set window height only when cfg.position is bottom or top (#14)
According to `:help topleft` and `:help botright`, these commands creates a window with the full height of the Vim window when used with `vnew`, so we don't need to update the `height` variable when using these commands.
This commit is contained in:
@@ -65,16 +65,16 @@ M.toggle = function()
|
||||
width = vim.api.nvim_win_get_height(prev_win)
|
||||
elseif cfg.position == "left" then
|
||||
vim.api.nvim_command("topleft vnew")
|
||||
height = vim.api.nvim_win_get_height(prev_win)
|
||||
else
|
||||
vim.api.nvim_command("botright vnew")
|
||||
height = vim.api.nvim_win_get_height(prev_win)
|
||||
end
|
||||
|
||||
win = vim.api.nvim_get_current_win()
|
||||
buf = vim.api.nvim_get_current_buf()
|
||||
|
||||
if cfg.position == "bottom" or cfg.position == "top" then
|
||||
vim.api.nvim_win_set_height(win, math.ceil(height))
|
||||
end
|
||||
vim.api.nvim_win_set_width(win, math.ceil(width))
|
||||
|
||||
vim.api.nvim_buf_set_name(buf, "Docs View")
|
||||
|
||||
Reference in New Issue
Block a user