|
80 | 80 | local function do_single_paste(source, dest, action_type, action_fn)
|
81 | 81 | local dest_stats
|
82 | 82 | local success, errmsg, errcode
|
| 83 | + local notify_source = notify.render_path(source) |
83 | 84 |
|
84 | 85 | log.line("copy_paste", "do_single_paste '%s' -> '%s'", source, dest)
|
85 | 86 |
|
86 | 87 | dest_stats, errmsg, errcode = vim.loop.fs_stat(dest)
|
87 | 88 | if not dest_stats and errcode ~= "ENOENT" then
|
88 |
| - notify.error("Could not " .. action_type .. " " .. source .. " - " .. (errmsg or "???")) |
| 89 | + notify.error("Could not " .. action_type .. " " .. notify_source .. " - " .. (errmsg or "???")) |
89 | 90 | return false, errmsg
|
90 | 91 | end
|
91 | 92 |
|
92 | 93 | local function on_process()
|
93 | 94 | success, errmsg = action_fn(source, dest)
|
94 | 95 | if not success then
|
95 |
| - notify.error("Could not " .. action_type .. " " .. source .. " - " .. (errmsg or "???")) |
| 96 | + notify.error("Could not " .. action_type .. " " .. notify_source .. " - " .. (errmsg or "???")) |
96 | 97 | return false, errmsg
|
97 | 98 | end
|
98 | 99 |
|
@@ -133,15 +134,16 @@ local function add_to_clipboard(node, clip)
|
133 | 134 | if node.name == ".." then
|
134 | 135 | return
|
135 | 136 | end
|
| 137 | + local notify_node = notify.render_path(node.absolute_path) |
136 | 138 |
|
137 | 139 | for idx, _node in ipairs(clip) do
|
138 | 140 | if _node.absolute_path == node.absolute_path then
|
139 | 141 | table.remove(clip, idx)
|
140 |
| - return notify.info(node.absolute_path .. " removed from clipboard.") |
| 142 | + return notify.info(notify_node .. " removed from clipboard.") |
141 | 143 | end
|
142 | 144 | end
|
143 | 145 | table.insert(clip, node)
|
144 |
| - notify.info(node.absolute_path .. " added to clipboard.") |
| 146 | + notify.info(notify_node .. " added to clipboard.") |
145 | 147 | end
|
146 | 148 |
|
147 | 149 | function M.clear_clipboard()
|
@@ -172,7 +174,7 @@ local function do_paste(node, action_type, action_fn)
|
172 | 174 | local stats, errmsg, errcode = vim.loop.fs_stat(destination)
|
173 | 175 | if not stats and errcode ~= "ENOENT" then
|
174 | 176 | log.line("copy_paste", "do_paste fs_stat '%s' failed '%s'", destination, errmsg)
|
175 |
| - notify.error("Could not " .. action_type .. " " .. destination .. " - " .. (errmsg or "???")) |
| 177 | + notify.error("Could not " .. action_type .. " " .. notify.render_path(destination) .. " - " .. (errmsg or "???")) |
176 | 178 | return
|
177 | 179 | end
|
178 | 180 | local is_dir = stats and stats.type == "directory"
|
@@ -223,13 +225,13 @@ function M.print_clipboard()
|
223 | 225 | if #clipboard.move > 0 then
|
224 | 226 | table.insert(content, "Cut")
|
225 | 227 | for _, item in pairs(clipboard.move) do
|
226 |
| - table.insert(content, " * " .. item.absolute_path) |
| 228 | + table.insert(content, " * " .. (notify.render_path(item.absolute_path))) |
227 | 229 | end
|
228 | 230 | end
|
229 | 231 | if #clipboard.copy > 0 then
|
230 | 232 | table.insert(content, "Copy")
|
231 | 233 | for _, item in pairs(clipboard.copy) do
|
232 |
| - table.insert(content, " * " .. item.absolute_path) |
| 234 | + table.insert(content, " * " .. (notify.render_path(item.absolute_path))) |
233 | 235 | end
|
234 | 236 | end
|
235 | 237 |
|
|
0 commit comments