fix(octo): fixed octo's rendering of comment signs when lines are wrapped

This commit is contained in:
Folke Lemaitre 2024-06-06 16:05:55 +02:00
parent 1f4c1964fd
commit 81370cf714
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
2 changed files with 63 additions and 2 deletions

View file

@ -1,6 +1,9 @@
---@class lazyvim.util.ui
local M = {}
---@type (fun(buf:number, lnum:number, vnum:number, win:number):Sign[]?)[]
M.virtual = {}
---@alias Sign {name:string, text:string, texthl:string, priority:number}
-- Returns a list of regular and extmark signs sorted by priority (low to high)
@ -103,9 +106,20 @@ function M.statuscolumn()
local use_githl = vim.g.lazyvim_statuscolumn and vim.g.lazyvim_statuscolumn.folds_githl
if show_signs then
local signs = M.get_signs(buf, vim.v.lnum)
local has_virtual = false
for _, fn in ipairs(M.virtual) do
local virtual = fn(buf, vim.v.lnum, vim.v.virtnum, win)
if virtual then
has_virtual = true
vim.list_extend(signs, virtual)
end
end
---@type Sign?,Sign?,Sign?
local left, right, fold, githl
for _, s in ipairs(M.get_signs(buf, vim.v.lnum)) do
for _, s in ipairs(signs) do
if s.name and s.name:lower():find("^octo_clean") then
s.texthl = "IblScope"
end
@ -118,7 +132,7 @@ function M.statuscolumn()
left = s
end
end
if vim.v.virtnum ~= 0 and vim.bo[buf].filetype ~= "octo" then
if vim.v.virtnum ~= 0 and not has_virtual then
left = nil
end