feat(trash): support for deleting to windows recycle bin (#243)

* feat(windows-trash): support for deleting to windows trash

* feat(windows-trash): add support for view, restore and purge

* fix(windows-trash): undefined path on M.list

* chore(windows-trash): modify comments

* fix(windows-trash): show correct original_path

* fix(windows-trash): add self to powershell_date_grammar

* fix(windows-trash-support): parse deleted date as number

* fix(fs): do not add innecesary \\ on Windows

* feat: extend windows trash adapter

* perf(windows-trash): powershell -> libuv (move, purge and copy)

* fix: don't prompt to save when opening trashed file

* lint: fix luacheck error

* lint: fix luacheck errors

* lint: luacheck error

---------

Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
This commit is contained in:
TheLeoP 2024-01-03 01:05:01 -05:00 committed by GitHub
parent 523b61430c
commit 553b7a0ac1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 494 additions and 31 deletions

View file

@ -429,7 +429,9 @@ end
M.select = function(opts, callback)
local cache = require("oil.cache")
local config = require("oil.config")
local constants = require("oil.constants")
local pathutil = require("oil.pathutil")
local FIELD_META = constants.FIELD_META
opts = vim.tbl_extend("keep", opts or {}, {})
local function finish(err)
if err then
@ -498,6 +500,13 @@ M.select = function(opts, callback)
local is_new_entry = entry.id == nil
local is_moved_from_dir = entry.id and cache.get_parent_url(entry.id) ~= bufname
local is_renamed = entry.parsed_name ~= entry.name
local internal_entry = entry.id and cache.get_entry_by_id(entry.id)
if internal_entry then
local meta = internal_entry[FIELD_META]
if meta and meta.display_name then
is_renamed = entry.parsed_name ~= meta.display_name
end
end
if is_new_entry or is_moved_from_dir or is_renamed then
any_moved = true
break