fix: use vim.o.lines/vim.o.columns when calculating sidebar height/width (#570)

This commit is contained in:
Maddison Hellstrom 2024-09-13 07:53:06 -07:00 committed by GitHub
parent 0642905c80
commit 932535aa99
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1503,17 +1503,13 @@ function Sidebar:render(opts)
local get_height = function() local get_height = function()
local selected_code_size = self:get_selected_code_size() local selected_code_size = self:get_selected_code_size()
if self:get_layout() == "horizontal" then if self:get_layout() == "horizontal" then return math.floor(Config.windows.height / 100 * vim.o.lines) end
return math.floor(Config.windows.height / 100 * api.nvim_win_get_height(self.code.winid))
end
return math.max(1, api.nvim_win_get_height(self.code.winid) - selected_code_size - 3 - 8) return math.max(1, api.nvim_win_get_height(self.code.winid) - selected_code_size - 3 - 8)
end end
local get_width = function() local get_width = function()
if self:get_layout() == "vertical" then if self:get_layout() == "vertical" then return math.floor(Config.windows.width / 100 * vim.o.columns) end
return math.floor(Config.windows.width / 100 * api.nvim_win_get_width(self.code.winid))
end
return math.max(1, api.nvim_win_get_width(self.code.winid)) return math.max(1, api.nvim_win_get_width(self.code.winid))
end end