trash/windows: list silently drops file entries in show_all_files mode #10
Labels
No labels
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
barrettruth/canola-collection#10
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The `list` function in `lua/canola/adapters/trash/windows.lua` uses `vim.tbl_map`, which can only return one entry per source item. When `show_all_files = true` and an entry's original path is in a subdirectory of the current path, both the file-entry block and the directory-entry block execute for the same raw entry. The while loop in the directory block overwrites `cache_entry`, so the file entry is silently dropped and only the directory entry is returned.
The freedesktop adapter avoids this by using `table.insert` inside the callback to accumulate entries independently, allowing multiple entries per source item.
Solution
Restructure `list` to collect entries in a local list (like freedesktop does) instead of using `tbl_map`. This allows both the file entry and the intermediate directory entry to be emitted for the same raw item when `show_all_files = true`.