Use %{%eval%} blocks

This commit is contained in:
shadmansaleh 2021-05-21 11:14:54 +06:00
parent ef47235330
commit 46eed19a11
1 changed files with 2 additions and 8 deletions

View File

@ -140,11 +140,8 @@ local Component = {
vim.fn.win_getid() then vim.fn.win_getid() then
-- In that case we'll return a evaluator -- In that case we'll return a evaluator
self.status = '%' .. string.format( self.status = '%' .. string.format(
'{v:lua.require\'lualine.utils.utils\'.lualine_eval(%s,\'\',v:true)}', '{%%v:lua.require\'lualine.utils.utils\'.lualine_eval(%s,\'\',v:true)%%}',
tostring(self.component_no)) tostring(self.component_no))
-- Need to apply the highlights early as %{} escapes % :(
-- I'm not sure if it's a good idea. But don't have an option.
self:apply_highlights(default_highlight)
return self.status return self.status
end end
self.status = '' self.status = ''
@ -158,10 +155,7 @@ local Component = {
self:apply_icon() self:apply_icon()
self:apply_case() self:apply_case()
self:apply_padding() self:apply_padding()
if not statusline_inactive then
-- incase of inactive eval highlight hasbeen pre applied
self:apply_highlights(default_highlight) self:apply_highlights(default_highlight)
end
if not (statusline_inactive and self.last_conponent) then if not (statusline_inactive and self.last_conponent) then
self:apply_separator() self:apply_separator()
end end