refactor(renderer): extract build line function

This commit is contained in:
kiyan
2022-04-24 15:08:05 +02:00
parent 785761591f
commit efcadc482b

View File

@@ -182,8 +182,7 @@ function Builder:_build_file(node, padding, git_highlight)
end
end
function Builder:build(tree)
for idx, node in ipairs(tree.nodes) do
function Builder:_build_line(tree, node, idx)
local padding = pad.get_padding(self.depth, idx, tree, node, self.markers)
if self.depth > 0 then
@@ -209,6 +208,11 @@ function Builder:build(tree)
self:build(node)
self.depth = self.depth - 2
end
end
function Builder:build(tree)
for idx, node in ipairs(tree.nodes) do
self:_build_line(tree, node, idx)
end
return self