fix flickering while working one enter=false floats

some of them are caused by https://github.com/neovim/neovim/issues/15300
some are https://github.com/neovim/neovim/issues/19464
and other unknown bugs too

So as workaround don't update statusline in autocmd context immediately
instead defer the refresh to 50ms later in timer context.

fixes   
This commit is contained in:
shadmansaleh 2022-07-27 21:51:54 +06:00
parent 5f68f070e4
commit 2d6108e07f

@ -307,20 +307,17 @@ local function refresh(opts)
opts = { kind = 'tabpage', place = { 'statusline', 'winbar', 'tabline' }, trigger = 'unknown' } opts = { kind = 'tabpage', place = { 'statusline', 'winbar', 'tabline' }, trigger = 'unknown' }
end end
-- updating statusline in autocommands context seems to trigger 100 different bugs
-- lets just defer it to a timer context and update there
-- workaround for https://github.com/neovim/neovim/issues/15300
-- workaround for https://github.com/neovim/neovim/issues/19464 -- workaround for https://github.com/neovim/neovim/issues/19464
if -- workaround for https://github.com/nvim-lualine/lualine.nvim/issues/753
opts.trigger == 'autocmd' -- workaround for https://github.com/nvim-lualine/lualine.nvim/issues/751
and vim.api.nvim_win_get_height(vim.api.nvim_get_current_win()) <= 1 -- workaround for https://github.com/nvim-lualine/lualine.nvim/issues/755
and vim.tbl_contains(opts.place, 'winbar') if opts.trigger == 'autocmd' then
then opts.trigger = 'timer'
local id vim.defer_fn(function() M.refresh(opts) end, 50)
for index, value in ipairs(opts.place) do return
if value == 'winbar' then
id = index
break
end
end
table.remove(opts.place, id)
end end
local wins = {} local wins = {}