From 932535aa99d89573b73a83f3b274a0bee2ae781f Mon Sep 17 00:00:00 2001 From: Maddison Hellstrom Date: Fri, 13 Sep 2024 07:53:06 -0700 Subject: [PATCH] fix: use `vim.o.lines`/`vim.o.columns` when calculating sidebar height/width (#570) --- lua/avante/sidebar.lua | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lua/avante/sidebar.lua b/lua/avante/sidebar.lua index a47c223..da09739 100644 --- a/lua/avante/sidebar.lua +++ b/lua/avante/sidebar.lua @@ -1503,17 +1503,13 @@ function Sidebar:render(opts) local get_height = function() local selected_code_size = self:get_selected_code_size() - if self:get_layout() == "horizontal" then - return math.floor(Config.windows.height / 100 * api.nvim_win_get_height(self.code.winid)) - end + if self:get_layout() == "horizontal" then return math.floor(Config.windows.height / 100 * vim.o.lines) end return math.max(1, api.nvim_win_get_height(self.code.winid) - selected_code_size - 3 - 8) end local get_width = function() - if self:get_layout() == "vertical" then - return math.floor(Config.windows.width / 100 * api.nvim_win_get_width(self.code.winid)) - end + if self:get_layout() == "vertical" then return math.floor(Config.windows.width / 100 * vim.o.columns) end return math.max(1, api.nvim_win_get_width(self.code.winid)) end