fix: left section separator not displayed when component begins with a custom highlight

This commit is contained in:
shadmansaleh 2021-08-05 21:44:22 +06:00
parent 65464f7849
commit 66b0736fd4
1 changed files with 4 additions and 2 deletions

View File

@ -70,9 +70,11 @@ function M.draw_section(section, section_name, is_focused)
-- Remove empty strings from status -- Remove empty strings from status
status = utils.list_shrink(status) status = utils.list_shrink(status)
local status_str = table.concat(status) local status_str = table.concat(status)
if status_str:find('%%#.*#') == 1 or #status_str == 0 then
if #status_str == 0 then return ''
elseif status_str:find('%%#.*#') == 1 then
-- Don't prepend with old highlight when the component changes it imidiately -- Don't prepend with old highlight when the component changes it imidiately
return status_str return left_sparator_string .. status_str
else else
return left_sparator_string .. highlight_name .. status_str return left_sparator_string .. highlight_name .. status_str
end end