fix(ui): always pad to 2 cells for status column icons. Fixes #1571

This commit is contained in:
Folke Lemaitre 2023-10-03 18:28:02 +02:00
parent e08813fa11
commit 6cf6b0a624
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040

View file

@ -15,7 +15,7 @@ end
---@param len? number ---@param len? number
function M.icon(sign, len) function M.icon(sign, len)
sign = sign or {} sign = sign or {}
len = len or 1 len = len or 2
local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string local text = vim.fn.strcharpart(sign.text or "", 0, len) ---@type string
text = text .. string.rep(" ", len - vim.fn.strchars(text)) text = text .. string.rep(" ", len - vim.fn.strchars(text))
return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text return sign.texthl and ("%#" .. sign.texthl .. "#" .. text .. "%*") or text
@ -71,7 +71,7 @@ function M.statuscolumn()
M.icon(left), M.icon(left),
[[%=]], [[%=]],
nu .. " ", nu .. " ",
M.icon(fold or right, 2), M.icon(fold or right),
}, "") }, "")
end end