Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions lua/virt-column/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ local init = function()
return a > b
end)

pcall(vim.api.nvim_buf_clear_namespace, bufnr, M.namespace, topline, botline_guess)
pcall(vim.api.nvim_buf_clear_namespace, bufnr, M.namespace, topline, botline_guess + 1)

local highlight = config.highlight
if type(highlight) == "string" then
Expand All @@ -75,11 +75,11 @@ local init = function()
for j, column in ipairs(colorcolumn) do
local width = vim.api.nvim_win_call(win, function()
---@diagnostic disable-next-line
return vim.fn.virtcol { i, "$" } - 1
return vim.fn.virtcol { i + 1, "$" } - 1
end)
if width < column then
local column_index = #colorcolumn - j + 1
pcall(vim.api.nvim_buf_set_extmark, bufnr, M.namespace, i - 1, 0, {
pcall(vim.api.nvim_buf_set_extmark, bufnr, M.namespace, i, 0, {
virt_text = {
{
utils.tbl_get_index(char, column_index),
Expand All @@ -95,10 +95,10 @@ local init = function()
end
local fold_end = vim.api.nvim_win_call(win, function()
---@diagnostic disable-next-line: redundant-return-value
return vim.fn.foldclosedend(i)
return vim.fn.foldclosedend(i + 1)
end)
if fold_end ~= -1 then -- line is folded
i = fold_end
i = fold_end - 1
end
i = i + 1
end
Expand Down