Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixup: fix attr inheritance breaking highlights #1315

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lua/lualine.lua
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ local function set_tabline(hide)
timers.halt_tal_refresh = true
vim.cmd([[augroup lualine_tal_refresh | exe "autocmd!" | augroup END]])
if not hide and next(config.tabline) ~= nil then
modules.highlight.set_hl_to_normal('TabLine')
vim.loop.timer_start(
timers.tal_timer,
0,
Expand Down Expand Up @@ -495,6 +496,8 @@ local function set_statusline(hide)
timers.halt_stl_refresh = true
vim.cmd([[augroup lualine_stl_refresh | exe "autocmd!" | augroup END]])
if not hide and (next(config.sections) ~= nil or next(config.inactive_sections) ~= nil) then
modules.highlight.set_hl_to_normal('StatusLine')
modules.highlight.set_hl_to_normal('StatusLineNC')
if vim.go.statusline == '' then
modules.nvim_opts.set('statusline', '%#Normal#', { global = true })
end
Expand Down Expand Up @@ -548,6 +551,8 @@ local function set_winbar(hide)
timers.halt_wb_refresh = true
vim.cmd([[augroup lualine_wb_refresh | exe "autocmd!" | augroup END]])
if not hide and (next(config.winbar) ~= nil or next(config.inactive_winbar) ~= nil) then
modules.highlight.set_hl_to_normal('Winbar')
modules.highlight.set_hl_to_normal('WinbarNC')
vim.loop.timer_start(
timers.wb_timer,
0,
Expand Down
11 changes: 11 additions & 0 deletions lua/lualine/highlight.lua
Original file line number Diff line number Diff line change
Expand Up @@ -491,4 +491,15 @@ function M.get_stl_default_hl(focused)
end
end

--- set the hl_name group to Normal
--- used to avoid conflict with hl groups like StatusLine, StatusLineNc...
--- @param hl_name string
function M.set_hl_to_normal(hl_name)
local normal_color = modules.utils.extract_highlight_colors('Normal', nil)
if normal_color.reverse then -- swap
normal_color.fg, normal_color.bg = normal_color.bg, normal_color.fg
end
M.highlight(hl_name, normal_color.fg, normal_color.bg, 'None', nil)
end

return M
Loading