Skip to content

Commit

Permalink
feat(decorator): export fold kind in fold_virt_text_handler (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhwang91 committed Mar 23, 2024
1 parent b22a652 commit 458aa44
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lua/ufo/decorator.lua
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,8 @@ function Decorator:getVirtTextAndCloseFold(winid, lnum, endLnum, doRender)
local getFoldVirtText
if self.enableGetFoldVirtText then
getFoldVirtText = function(l)
assert(type(l) == 'number', 'expected a number, got ' .. type(l))
local t = type(l)
assert(t == 'number', 'expected a number, got ' .. t)
assert(lnum <= l and l <= endLnum,
('expected lnum range from %d to %d, got %d'):format(lnum, endLnum, l))
local line = fb:lines(l)[1]
Expand All @@ -250,6 +251,12 @@ function Decorator:getVirtTextAndCloseFold(winid, lnum, endLnum, doRender)
bufnr = bufnr,
winid = winid,
text = text,
get_fold_kind = function(l)
l = l == nil and lnum or l
local t = type(l)
assert(t == 'number', 'expected a number, got ' .. t)
return fb:lineKind(winid, l)
end,
get_fold_virt_text = getFoldVirtText
})
wses.foldedTextMaps[lnum] = res
Expand Down

0 comments on commit 458aa44

Please sign in to comment.