fix(ui): reset buf and win options on resize

This commit is contained in:
Folke Lemaitre 2023-01-11 13:43:17 +01:00
parent 5aca9280df
commit 3b44c3c14a
No known key found for this signature in database
GPG Key ID: 41F8B1FBACAE2040
1 changed files with 11 additions and 5 deletions

View File

@ -103,11 +103,15 @@ function M:mount()
if vim.bo[self.buf].filetype == "" then if vim.bo[self.buf].filetype == "" then
vim.bo[self.buf].filetype = "lazy" vim.bo[self.buf].filetype = "lazy"
end end
local function opts()
vim.bo[self.buf].bufhidden = "wipe" vim.bo[self.buf].bufhidden = "wipe"
vim.wo[self.win].conceallevel = 3 vim.wo[self.win].conceallevel = 3
vim.wo[self.win].spell = false vim.wo[self.win].spell = false
vim.wo[self.win].wrap = true vim.wo[self.win].wrap = true
vim.wo[self.win].winhighlight = "Normal:LazyNormal" vim.wo[self.win].winhighlight = "Normal:LazyNormal"
end
opts()
vim.api.nvim_create_autocmd("VimResized", { vim.api.nvim_create_autocmd("VimResized", {
callback = function() callback = function()
@ -120,7 +124,9 @@ function M:mount()
---@diagnostic disable-next-line: no-unknown ---@diagnostic disable-next-line: no-unknown
config[key] = self.win_opts[key] config[key] = self.win_opts[key]
end end
config.style = self.opts.style ~= "" and self.opts.style or nil
vim.api.nvim_win_set_config(self.win, config) vim.api.nvim_win_set_config(self.win, config)
opts()
vim.cmd([[do User LazyFloatResized]]) vim.cmd([[do User LazyFloatResized]])
end, end,
}) })