ignore +N -N columns when textwidth is 0

fix #21
This commit is contained in:
Lukas Reineke
2022-02-24 15:19:52 +09:00
parent 07c7a3e7d8
commit 3640664d06
+10 -2
View File
@@ -56,9 +56,17 @@ M.refresh = function()
for i, c in ipairs(colorcolumn) do
if vim.startswith(c, "+") then
colorcolumn[i] = textwidth + tonumber(c:sub(2))
if textwidth ~= 0 then
colorcolumn[i] = textwidth + tonumber(c:sub(2))
else
colorcolumn[i] = nil
end
elseif vim.startswith(c, "-") then
colorcolumn[i] = textwidth - tonumber(c:sub(2))
if textwidth ~= 0 then
colorcolumn[i] = textwidth - tonumber(c:sub(2))
else
colorcolumn[i] = nil
end
else
colorcolumn[i] = tonumber(c)
end