mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
refactor(WIP): use new Lua APIs introduced with #674
This commit is contained in:
parent
066841c5cb
commit
458ca3b47b
1 changed files with 7 additions and 20 deletions
|
|
@ -15,30 +15,17 @@ function Header:cwd()
|
|||
end
|
||||
|
||||
function Header:selected_count()
|
||||
local selected = 0
|
||||
local copied = 0
|
||||
local cut = 0
|
||||
|
||||
for _, f in ipairs(Folder:by_kind(Folder.CURRENT).window) do
|
||||
if f:is_selected() then
|
||||
selected = selected + 1
|
||||
end
|
||||
|
||||
local is_yanked = f:is_yanked()
|
||||
if is_yanked == 1 then
|
||||
copied = copied + 1
|
||||
elseif is_yanked == 2 then
|
||||
cut = cut + 1
|
||||
end
|
||||
end
|
||||
local selected = #cx.active.selected
|
||||
local yanked = #cx.yanked
|
||||
local is_cut = cx.yanked.is_cut
|
||||
|
||||
local count
|
||||
local style
|
||||
if cut > 0 then
|
||||
count = cut
|
||||
if is_cut then
|
||||
count = yanked
|
||||
style = THEME.manager.count_cut
|
||||
elseif copied > 0 then
|
||||
count = copied
|
||||
elseif yanked > 0 then
|
||||
count = yanked
|
||||
style = THEME.manager.count_copied
|
||||
else
|
||||
count = selected
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue