Return if pasting on root and remove continue.
This commit is contained in:
parent
86ff3b725f
commit
7ddee0a79c
@ -142,6 +142,7 @@ local function do_copy(source, destination)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function do_paste(node, action_type, action_fn)
|
local function do_paste(node, action_type, action_fn)
|
||||||
|
if node.name == '..' then return end
|
||||||
local clip = clipboard[action_type]
|
local clip = clipboard[action_type]
|
||||||
if #clip == 0 then return end
|
if #clip == 0 then return end
|
||||||
|
|
||||||
@ -170,17 +171,19 @@ local function do_paste(node, action_type, action_fn)
|
|||||||
for _, entry in ipairs(clip) do
|
for _, entry in ipairs(clip) do
|
||||||
local dest = destination..'/'..entry.name
|
local dest = destination..'/'..entry.name
|
||||||
local dest_stats = luv.fs_stat(dest)
|
local dest_stats = luv.fs_stat(dest)
|
||||||
|
local should_process = true
|
||||||
if dest_stats then
|
if dest_stats then
|
||||||
local ans = vim.fn.input(dest..' already exists, overwrite ? y/n: ')
|
local ans = vim.fn.input(dest..' already exists, overwrite ? y/n: ')
|
||||||
clear_prompt()
|
clear_prompt()
|
||||||
if not ans:match('^y') then goto continue end
|
should_process = ans:match('^y')
|
||||||
end
|
end
|
||||||
|
|
||||||
local success, msg = action_fn(entry.absolute_path, dest)
|
if should_process then
|
||||||
if not success then
|
local success, msg = action_fn(entry.absolute_path, dest)
|
||||||
api.nvim_err_writeln('Could not '..action_type..' '..entry.absolute_path..' - '..msg)
|
if not success then
|
||||||
|
api.nvim_err_writeln('Could not '..action_type..' '..entry.absolute_path..' - '..msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
::continue::
|
|
||||||
end
|
end
|
||||||
clipboard[action_type] = {}
|
clipboard[action_type] = {}
|
||||||
return refresh_tree()
|
return refresh_tree()
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user