fix: signify highlight fix (#108)

This commit is contained in:
Shadman 2021-02-22 05:07:44 +06:00 committed by GitHub
parent 9505115133
commit 3b36b5a151
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -21,7 +21,17 @@ end
local function apply_padding(status, options) local function apply_padding(status, options)
local l_padding = (options.left_padding or options.padding or 1) local l_padding = (options.left_padding or options.padding or 1)
local r_padding = (options.right_padding or options.padding or 1) local r_padding = (options.right_padding or options.padding or 1)
if l_padding then status = string.rep(' ', l_padding)..status end if l_padding then
if status:find('%%#.*#') == 1 then
-- When component has changed the highlight at begining
-- we will add the padding after the highlight
local pre_highlight = vim.fn.matchlist(status, [[\(%#.\{-\}#\)]])[2]
status = pre_highlight .. string.rep(' ', l_padding)..
status:sub(#pre_highlight + 1, #status)
else
status = string.rep(' ', l_padding)..status
end
end
if r_padding then status = status..string.rep(' ', r_padding) end if r_padding then status = status..string.rep(' ', r_padding) end
return status return status
end end