chore: resolve undefined-field

This commit is contained in:
Alexander Courtis
2024-10-26 15:15:28 +11:00
parent eacb61008d
commit 5290897260

View File

@@ -221,8 +221,11 @@ end
function Clipboard:do_paste(node, action, action_fn) function Clipboard:do_paste(node, action, action_fn)
if node.name == ".." then if node.name == ".." then
node = self.explorer node = self.explorer
elseif node:is(DirectoryNode) then else
node = node:last_group_node() local dir = node:as(DirectoryNode)
if dir then
node = dir:last_group_node()
end
end end
local clip = self.data[action] local clip = self.data[action]
if #clip == 0 then if #clip == 0 then
@@ -373,7 +376,7 @@ function Clipboard:copy_path(node)
end end
local relative_path = utils.path_relative(absolute_path, cwd) local relative_path = utils.path_relative(absolute_path, cwd)
content = node.nodes ~= nil and utils.path_add_trailing(relative_path) or relative_path content = node:is(DirectoryNode) and utils.path_add_trailing(relative_path) or relative_path
end end
self:copy_to_reg(content) self:copy_to_reg(content)