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
|
end
|
||||||
|
|
||||||
function Header:selected_count()
|
function Header:selected_count()
|
||||||
local selected = 0
|
local selected = #cx.active.selected
|
||||||
local copied = 0
|
local yanked = #cx.yanked
|
||||||
local cut = 0
|
local is_cut = cx.yanked.is_cut
|
||||||
|
|
||||||
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 count
|
local count
|
||||||
local style
|
local style
|
||||||
if cut > 0 then
|
if is_cut then
|
||||||
count = cut
|
count = yanked
|
||||||
style = THEME.manager.count_cut
|
style = THEME.manager.count_cut
|
||||||
elseif copied > 0 then
|
elseif yanked > 0 then
|
||||||
count = copied
|
count = yanked
|
||||||
style = THEME.manager.count_copied
|
style = THEME.manager.count_copied
|
||||||
else
|
else
|
||||||
count = selected
|
count = selected
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue