From 7db1db3cd97079cf9c0089bc04afe71e90256a23 Mon Sep 17 00:00:00 2001 From: shadmansaleh <13149513+shadmansaleh@users.noreply.github.com> Date: Fri, 18 Mar 2022 07:52:18 +0600 Subject: [PATCH] fix: icons from different filetype component shareing same highlight group fixes #610 --- lua/lualine/components/filetype.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lua/lualine/components/filetype.lua b/lua/lualine/components/filetype.lua index e86aa9c..7bf2767 100644 --- a/lua/lualine/components/filetype.lua +++ b/lua/lualine/components/filetype.lua @@ -15,6 +15,7 @@ local default_options = { function M:init(options) M.super.init(self, options) self.options = vim.tbl_deep_extend('keep', self.options or {}, default_options) + self.icon_hl_cache = {} end function M.update_status() @@ -22,7 +23,6 @@ function M.update_status() return modules.utils.stl_escape(ft) end -local icon_hl_cache = {} function M:apply_icon() if not self.options.icons_enabled then return @@ -39,7 +39,7 @@ function M:apply_icon() local highlight_color = modules.utils.extract_highlight_colors(icon_highlight_group, 'fg') if highlight_color then local default_highlight = self:get_default_hl() - local icon_highlight = icon_hl_cache[highlight_color] + local icon_highlight = self.icon_hl_cache[highlight_color] if not icon_highlight or not modules.highlight.highlight_exists(icon_highlight.name .. '_normal') then icon_highlight = modules.highlight.create_component_highlight_group( { fg = highlight_color }, @@ -47,7 +47,7 @@ function M:apply_icon() self.options, false ) - icon_hl_cache[highlight_color] = icon_highlight + self.icon_hl_cache[highlight_color] = icon_highlight end icon = modules.highlight.component_format_highlight(icon_highlight) .. icon .. default_highlight