Skip to content

Commit

Permalink
fix: first render not accounting for filetype and others
Browse files Browse the repository at this point in the history
  • Loading branch information
shadmansaleh committed Nov 8, 2024
1 parent 70fef24 commit 2a5bae9
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions lua/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,11 @@ local function set_tabline(hide)
)
modules.nvim_opts.set('showtabline', config.options.always_show_tabline and 2 or 1, { global = true })
timers.halt_tal_refresh = false
-- imediately refresh upon load
refresh { kind = 'tabpage', place = { 'tabline' }, trigger = 'init' }
vim.schedule(function()
-- imediately refresh upon load
-- schedule needed so stuff like filetype detect can run first
refresh { kind = 'tabpage', place = { 'tabline' }, trigger = 'init' }
end)
else
modules.nvim_opts.restore('tabline', { global = true })
modules.nvim_opts.restore('showtabline', { global = true })
Expand Down Expand Up @@ -481,12 +484,15 @@ local function set_statusline(hide)
)
end
timers.halt_stl_refresh = false
-- imediately refresh upon load
if config.options.globalstatus then
refresh { kind = 'window', place = { 'statusline' }, trigger = 'init' }
else
refresh { kind = 'tabpage', place = { 'statusline' }, trigger = 'init' }
end
vim.schedule(function()
-- imediately refresh upon load
-- schedule needed so stuff like filetype detect can run first
if config.options.globalstatus then
refresh { kind = 'window', place = { 'statusline' }, trigger = 'init' }
else
refresh { kind = 'tabpage', place = { 'statusline' }, trigger = 'init' }
end
end)
else
modules.nvim_opts.restore('statusline', { global = true })
for _, win in ipairs(vim.api.nvim_list_wins()) do
Expand All @@ -511,8 +517,11 @@ local function set_winbar(hide)
end, 3, 'lualine: Failed to refresh winbar')
)
timers.halt_wb_refresh = false
-- imediately refresh upon load
refresh { kind = 'tabpage', place = { 'winbar' }, trigger = 'init' }
vim.schedule(function()
-- imediately refresh upon load.
-- schedule needed so stuff like filetype detect can run first
refresh { kind = 'tabpage', place = { 'winbar' }, trigger = 'init' }
end)
elseif vim.fn.has('nvim-0.8') == 1 then
modules.nvim_opts.restore('winbar', { global = true })
for _, win in ipairs(vim.api.nvim_list_wins()) do
Expand Down

0 comments on commit 2a5bae9

Please sign in to comment.