2023-12-26 14:48:33 +03:00
|
|
|
Current = {
|
|
|
|
area = ui.Rect.default,
|
|
|
|
}
|
|
|
|
|
|
|
|
function Current:render(area)
|
|
|
|
self.area = area
|
|
|
|
|
2024-02-15 15:20:28 +03:00
|
|
|
local files = Folder:by_kind(Folder.CURRENT).window
|
|
|
|
if #files == 0 then
|
|
|
|
return {}
|
|
|
|
end
|
|
|
|
|
|
|
|
local items, markers = {}, {}
|
|
|
|
for i, f in ipairs(files) do
|
2023-12-26 14:48:33 +03:00
|
|
|
local name = Folder:highlighted_name(f)
|
|
|
|
|
|
|
|
-- Highlight hovered file
|
|
|
|
local item = ui.ListItem(ui.Line { Folder:icon(f), table.unpack(name) })
|
|
|
|
if f:is_hovered() then
|
|
|
|
item = item:style(THEME.manager.hovered)
|
|
|
|
else
|
|
|
|
item = item:style(f:style())
|
|
|
|
end
|
|
|
|
items[#items + 1] = item
|
|
|
|
|
|
|
|
-- Mark yanked/selected files
|
|
|
|
local yanked = f:is_yanked()
|
|
|
|
if yanked ~= 0 then
|
|
|
|
markers[#markers + 1] = { i, yanked }
|
|
|
|
elseif f:is_selected() then
|
|
|
|
markers[#markers + 1] = { i, 3 }
|
|
|
|
end
|
|
|
|
end
|
2024-02-15 15:20:28 +03:00
|
|
|
|
|
|
|
return ya.flat {
|
|
|
|
ui.List(area, items),
|
|
|
|
Folder:linemode(area, files),
|
|
|
|
Folder:markers(area, markers),
|
|
|
|
}
|
2023-12-26 14:48:33 +03:00
|
|
|
end
|