Skip to content

Commit

Permalink
fix: exclude root from target by toggle_select_all
Browse files Browse the repository at this point in the history
  • Loading branch information
amedama41 committed Jul 29, 2023
1 parent 853cc01 commit bbb6116
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lua/vfiler/actions/select.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ end

function M.toggle_select_all(vfiler, context, view)
for item in view:walk_items() do
item.selected = not item.selected
if item ~= context.root then
item.selected = not item.selected
end
end
view:redraw()
end
Expand Down
4 changes: 3 additions & 1 deletion tests/vfiler/actions/select_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ describe('select actions', function()
it(u.vfiler.desc('toggle_select_all', vfiler), function()
vfiler:do_action(a.toggle_select_all)
for item in vfiler._view:walk_items() do
assert.is_true(item.selected)
if item ~= vfiler._context.root then
assert.is_true(item.selected)
end
end
end)
end)
Expand Down

0 comments on commit bbb6116

Please sign in to comment.