Skip to content

Commit 7ddee0a

Browse files
Return if pasting on root and remove continue.
1 parent 86ff3b7 commit 7ddee0a

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lua/lib/fs.lua

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ local function do_copy(source, destination)
142142
end
143143

144144
local function do_paste(node, action_type, action_fn)
145+
if node.name == '..' then return end
145146
local clip = clipboard[action_type]
146147
if #clip == 0 then return end
147148

@@ -170,17 +171,19 @@ local function do_paste(node, action_type, action_fn)
170171
for _, entry in ipairs(clip) do
171172
local dest = destination..'/'..entry.name
172173
local dest_stats = luv.fs_stat(dest)
174+
local should_process = true
173175
if dest_stats then
174176
local ans = vim.fn.input(dest..' already exists, overwrite ? y/n: ')
175177
clear_prompt()
176-
if not ans:match('^y') then goto continue end
178+
should_process = ans:match('^y')
177179
end
178180

179-
local success, msg = action_fn(entry.absolute_path, dest)
180-
if not success then
181-
api.nvim_err_writeln('Could not '..action_type..' '..entry.absolute_path..' - '..msg)
181+
if should_process then
182+
local success, msg = action_fn(entry.absolute_path, dest)
183+
if not success then
184+
api.nvim_err_writeln('Could not '..action_type..' '..entry.absolute_path..' - '..msg)
185+
end
182186
end
183-
::continue::
184187
end
185188
clipboard[action_type] = {}
186189
return refresh_tree()

0 commit comments

Comments
 (0)