fix: adjust more to make it backward compatible for 0.11-

This commit is contained in:
27Onion Nebell
2025-04-12 12:26:40 +08:00
parent 5779c6f6a7
commit 1460136dd0
6 changed files with 66 additions and 14 deletions

View File

@@ -68,7 +68,19 @@ function Float:open(lines, hl, title, indent)
if hl then
self.ns = vim.api.nvim_create_namespace('OutlineHelp')
for _, h in ipairs(hl) do
vim.hl.range(self.bufnr, self.ns, h.name, { h.line, h.from + indent }, { h.line, (h.to ~= -1 and h.to + indent) or -1 })
if _G._outline_nvim_has[11] then
vim.hl.range(self.bufnr, self.ns, h.name, { h.line, h.from + indent }, { h.line, (h.to ~= -1 and h.to + indent) or -1 })
else
---@diagnostic disable-next-line:deprecated
vim.api.nvim_buf_add_highlight(
self.bufnr,
self.ns,
h.name,
h.line,
h.from + indent,
(h.to ~= -1 and h.to + indent) or -1
)
end
end
end
end