feat(#2277): skip overwrite prompt when copy/cut paste into same directory (#2278)

This commit is contained in:
Alexander Courtis
2023-06-25 11:37:55 +10:00
committed by GitHub
parent c3c6544ee0
commit 7aff29d755

View File

@@ -100,21 +100,30 @@ local function do_single_paste(source, dest, action_type, action_fn)
end end
if dest_stats then if dest_stats then
local prompt_select = "Overwrite " .. dest .. " ?" if source == dest then
local prompt_input = prompt_select .. " y/n/r(ename): " vim.ui.input({ prompt = "Rename to ", default = dest, completion = "dir" }, function(new_dest)
lib.prompt(prompt_input, prompt_select, { "y", "n", "r" }, { "Yes", "No", "Rename" }, function(item_short) utils.clear_prompt()
utils.clear_prompt() if new_dest then
if item_short == "y" then do_single_paste(source, new_dest, action_type, action_fn)
on_process() end
elseif item_short == "r" then end)
vim.ui.input({ prompt = "Rename to ", default = dest, completion = "dir" }, function(new_dest) else
utils.clear_prompt() local prompt_select = "Overwrite " .. dest .. " ?"
if new_dest then local prompt_input = prompt_select .. " y/n/r(ename): "
do_single_paste(source, new_dest, action_type, action_fn) lib.prompt(prompt_input, prompt_select, { "y", "n", "r" }, { "Yes", "No", "Rename" }, function(item_short)
end utils.clear_prompt()
end) if item_short == "y" then
end on_process()
end) elseif item_short == "r" then
vim.ui.input({ prompt = "Rename to ", default = dest, completion = "dir" }, function(new_dest)
utils.clear_prompt()
if new_dest then
do_single_paste(source, new_dest, action_type, action_fn)
end
end)
end
end)
end
else else
on_process() on_process()
end end