Skip to content

Commit

Permalink
fixup: don't take over stl/wbr/tbl opts in ingnored filetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
shadmansaleh committed Jul 28, 2022
1 parent b378660 commit e9b05e7
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions lua/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ local function status_dispatch(sec_name)
)
then
-- disable on specific filetypes
return ''
return nil
end
local extension_sections = get_extension_sections(current_ft, is_focused, sec_name)
if extension_sections ~= nil then
Expand All @@ -299,7 +299,7 @@ end
---@class LualineRefreshOpts
---@field kind LualineRefreshOptsKind
---@field place LualineRefreshOptsPlace[]
---@field trigger 'autocmd'|'timer'|'unknown'
---@field trigger 'autocmd'|'autocmd_redired|timer'|'unknown'
--- Refresh contents of lualine
---@param opts LualineRefreshOpts
local function refresh(opts)
Expand All @@ -315,7 +315,7 @@ local function refresh(opts)
-- workaround for https://github.com/nvim-lualine/lualine.nvim/issues/751
-- workaround for https://github.com/nvim-lualine/lualine.nvim/issues/755
if opts.trigger == 'autocmd' then
opts.trigger = 'timer'
opts.trigger = 'autocmd_redired'
vim.defer_fn(function()
M.refresh(opts)
end, 50)
Expand Down Expand Up @@ -345,18 +345,30 @@ local function refresh(opts)
-- update them
if vim.tbl_contains(opts.place, 'statusline') then
for _, win in ipairs(wins) do
modules.nvim_opts.set('statusline', vim.api.nvim_win_call(win, M.statusline), { window = win })
local stl_cur = vim.api.nvim_win_call(win, M.statusline)
local stl_last = modules.nvim_opts.get_cache('statusline', { window = win })
if stl_cur or stl_last then
modules.nvim_opts.set('statusline', stl_cur, { window = win })
end
end
end
if vim.tbl_contains(opts.place, 'winbar') then
for _, win in ipairs(wins) do
if vim.api.nvim_win_get_height(win) > 1 then
modules.nvim_opts.set('winbar', vim.api.nvim_win_call(win, M.winbar), { window = win })
local wbr_cur = vim.api.nvim_win_call(win, M.winbar)
local wbr_last = modules.nvim_opts.get_cache('winbar', { window = win })
if wbr_cur or wbr_last then
modules.nvim_opts.set('winbar', wbr_cur, { window = win })
end
end
end
end
if vim.tbl_contains(opts.place, 'tabline') then
modules.nvim_opts.set('tabline', vim.api.nvim_win_call(vim.api.nvim_get_current_win(), tabline), { global = true })
local tbl_cur = vim.api.nvim_win_call(vim.api.nvim_get_current_win(), tabline)
local tbl_last = modules.nvim_opts.get_cache('tabline', { global = true })
if tbl_cur or tbl_last then
modules.nvim_opts.set('tabline', tbl_cur, { global = true })
end
end

vim.g.actual_curwin = old_actual_curwin
Expand Down

0 comments on commit e9b05e7

Please sign in to comment.