diff --git a/lua/precognition/init.lua b/lua/precognition/init.lua index b0b9d49..70939d4 100644 --- a/lua/precognition/init.lua +++ b/lua/precognition/init.lua @@ -267,6 +267,17 @@ local function display_marks() -- TODO: can we add indent lines to the virt line to match indent-blankline or similar (if installed)? + if vim.opt.wrap and #virt_line > 0 then + local width = vim.go.columns - vim.go.numberwidth - 1 + local cursorcolpos = vim.api.nvim_win_get_cursor(0)[2] + 1 + local section = math.floor(cursorcolpos / width) + local start = section * width + local end_ = start + width + if #virt_line[1][1] > width then + virt_line[1][1] = string.sub(virt_line[1][1], start, end_) + end + end + -- create (or overwrite) the extmark if config.showBlankVirtLine or (virt_line and #virt_line > 0) then extmark = vim.api.nvim_buf_set_extmark(0, ns, cursorline - 1, 0, {