🪴 a tiny, customizable statusline for neovim
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(utils): restore section highlight after inherit

robin 26116269 b0b4a84a

+10 -14
+10 -14
lua/lylla/utils.lua
··· 42 42 local sfmt_inherit = "%s%s" 43 43 -- str, hl_name, text 44 44 local hlfmt = "%s%%#%s#%s" 45 - local hlfmt_inherit = "%s%%$%s$%s" 45 + local hlfmt_inherit = "%s%%$%s$%s%%#%s#" 46 46 47 47 ---@param str string 48 48 ---@param text string 49 - ---@param inherit boolean 49 + ---@param inherit string|false 50 50 ---@param hl? string 51 51 ---@return string 52 52 local function strfmt(str, text, inherit, hl) 53 53 if hl then 54 - return string.format(inherit and hlfmt_inherit or hlfmt, str, hl, text) 54 + return string.format(inherit and hlfmt_inherit or hlfmt, str, hl, text, inherit or nil) 55 55 end 56 56 return string.format(inherit and sfmt_inherit or sfmt, str, text) 57 57 end ··· 63 63 ---@type string|false 64 64 local section = false 65 65 return vim.iter(ipairs(lst)):fold("", function(str, _, module) 66 - local inherit = not not section 67 66 if type(module) == "string" and #module > 0 then 68 - return strfmt(str, module, inherit) 67 + return strfmt(str, module, section) 69 68 end 70 69 if type(module) ~= "table" then 71 70 return str ··· 83 82 end 84 83 local hl = module[2] 85 84 if not hl then 86 - return strfmt(str, text, inherit) 85 + return strfmt(str, text, section) 87 86 end 88 87 if type(hl) == "string" and #hl > 0 then 89 - return strfmt(str, text, inherit, hl) 88 + return strfmt(str, text, section, hl) 90 89 elseif type(hl) == "table" and (hl.fg or hl.bg or hl.link) then 91 - inherit = inherit or hl.inherit 90 + local inherit = section or hl.inherit 92 91 hl.inherit = nil 93 - local hl_name = hl.link 94 - if not hl_name then 95 - hl_name = utils.create_hl(hl) 96 - end 92 + local hl_name = hl.link or utils.create_hl(hl) 97 93 return strfmt(str, text, inherit, hl_name) 98 94 elseif type(hl) == "table" and hl.inherit then 99 - return strfmt(str, text, true) 95 + return strfmt(str, text, hl.inherit) 100 96 end 101 97 102 - return strfmt(str, text, inherit) 98 + return strfmt(str, text, section) 103 99 end) 104 100 end 105 101