yazi/yazi-plugin/preset/components/parent.lua

31 lines
621 B
Lua
Raw Normal View History

Parent = {
area = ui.Rect.default,
}
function Parent:render(area)
self.area = area
local folder = Folder:by_kind(Folder.PARENT)
if not folder then
return {}
end
local items, markers = {}, {}
for i, f in ipairs(folder.window) do
2024-02-24 04:11:53 +03:00
local style = f:style()
items[#items + 1] = ui.ListItem(ui.Line(File:full(f)))
:style(f:is_hovered() and style:patch(THEME.manager.hovered) or style)
2024-02-15 15:24:20 +03:00
-- Yanked/marked/selected files
2024-02-24 04:11:53 +03:00
local marker = File:marker(f)
2024-02-15 15:24:20 +03:00
if marker ~= 0 then
markers[#markers + 1] = { i, marker }
end
end
return ya.flat {
ui.List(area, items),
Folder:markers(area, markers),
}
end