fix: disable all resizing when resize_to_content = false

This commit is contained in:
Steven Arcangeli 2023-06-22 08:02:35 -07:00
parent 9e600119f0
commit 075b0fac90
2 changed files with 6 additions and 2 deletions

View file

@ -42,8 +42,11 @@ local function resize_all_wins(aer_bufnr, preferred_width, preferred_height)
-- padding out whitespace. The gutter needs to adjust the total window
-- size, but it doesn't take space away from the content.
max_width = math.max(max_width, width - gutter)
if config.layout.resize_to_content or vim.b[aer_bufnr].aerial_width == nil then
if not vim.w[winid].aerial_set_width or config.layout.resize_to_content then
vim.api.nvim_win_set_width(winid, width)
vim.w[winid].aerial_set_width = true
else
max_width = math.max(max_width, vim.api.nvim_win_get_width(winid))
end
vim.b[aer_bufnr].aerial_width = width

View file

@ -108,8 +108,9 @@ local function setup_aerial_win(src_winid, aer_winid, aer_bufnr)
-- Set the filetype only after we enter the buffer so that ftplugins behave properly
vim.api.nvim_buf_set_option(aer_bufnr, "filetype", "aerial")
local width = vim.b[aer_bufnr].aerial_width
if width then
if width and (not vim.w[aer_winid].aerial_set_width or config.layout.resize_to_content) then
vim.api.nvim_win_set_width(aer_winid, width)
vim.w[aer_winid].aerial_set_width = true
end
if config.layout.preserve_equality then
vim.cmd.wincmd({ args = { "=" } })